Conas tá, mo chara Monk.(Alright Monks)

You helped me a while back(here and here) with a game I'm writing. I'm still having problems. It seems to be very hard to structure right.
Any who, the current problem is array related. The array is like so.
@array = ( 'north#library , 'south#kitchen', 'east#hallway')
You see its a fairly simple array pattern, you have you command on the left and the result on the right. I want to search through the array for the correct command and then assign the result to a variable called $location for examples sake, and if it doesn't find the command return an error message. I know that its probrably simple but I'm lost. Thanks.


P.s I've got this other problem aswell all this script does is print out the first few lines and I can't figure out why. Heres the code...
###main.pl use actions; use subs; print "Welcome to watever.\n"; print "This game will lead you through many perils and dangers that co +uld lead to your death.etc etc \n"; print "ONLY THE STRONG WILL SURVIVE"; my $data = "whatever" ; my $action; my @items= (); my $location = "hall"; my $health = "full"; &main($data, $location); sub main{ my( $data, $location ) = @_; while(<1>){ $data = &data($location); print $data; print "\n\n"; print "What do you want to do?? \n"; print "(type h for help.)\n"; print "Do what??\\: "; my $action = <>; my $noun = &action($action, $location); print $noun; } }
Thanking you in advance.
All the Best, Eoin...

If everything seems to be going well, you obviously don't know what the hell is going on.


In reply to array games?? by eoin

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.