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...

In reply to Re^2: Random Values from Hash with UNLESS statement by cmikel
in thread Random Values from Hash with UNLESS statement by cmikel

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.