in reply to Re: Random Values from Hash with UNLESS statement
in thread Random Values from Hash with UNLESS statement

thank you for the replies. i think i should have explained my setup a bit better. in my main.pl i have a hash of rooms which contains room object and direction object.
my %rooms = ( frontyard => Rooms->new( 1, 'Front Yard', 'You\'re standing in the front yard looking at the rundown hou +se.', Directions->new( 'hallway', 'exit' ) ), hallway => Rooms->new( 2, 'Hallway', 'Long and narrow with flickering lights.', Directions->new( 'backyard', 'frontyard', 'bedroom', 'kitchen' + ) ), . . . .etc
the directions object is a hash with the keys north, south, east, west respectively. the only 'room' that has an exit from the game is the front yard...(in the case the exit is south when standing in frontyard). so i do not want to generate 'exit' as the random room as it is not a room.

i was thinking of using hash keys because if it was defined then it would generate a random number which then would corresponded to a random key/value pair....now i do see why this might not be the best approach...