perlescent
Technical User
Having run a number of loops, I have built two arrays. Then I have used Data:
umper to remove duplicate entries from each array
eg @vacantRooms = 29 30 01 20 03 04 05 29 30 01 02 30 01;
is now, 29 30 01 02 03 04 05;
similar done for @nights Requested.
But how do I build a hash so that the rooms vacant on a certain date (eg 01) are shown with the room number?
bazz
eg @vacantRooms = 29 30 01 20 03 04 05 29 30 01 02 30 01;
is now, 29 30 01 02 03 04 05;
similar done for @nights Requested.
But how do I build a hash so that the rooms vacant on a certain date (eg 01) are shown with the room number?
Code:
for (@vacantRooms) { $vacant{$_}++; }
#print Dumper %vacant;
for $room (keys %vacant) {
if ($numberOfNightsRequested == $vacant{$room}) {
print "room = $room<br />"; prints the room numbers available on the selected dates.
#print "ARoom $room vacant for $vacant{$room} nights\n";
#return $room;
#print "\tnumber Of Nights Being Checked == nights vacant\n";
}
for (@nightsRequested) { $nights{$_}++; }
for $requested (keys %nights) {
#push (@nightsOfVisit, $requested);
print "req = $requested<br />"; # shows the dates 29 05 30 01 02 03
$available{$room}{$requested}= $_; # doesn't work yet.
print <<eof;
available = $available<br />
avaialbel{room} = $available{$room}<br />
eof
}
}
bazz