Yet again I am slightly lost,
It runs perfectly, however the array that prints at the bottom of the script that calls $city clearly has no value for $city.
As always thank everyone who takes the time to help and explain what I am missing!.
#!/usr/bin/perl print "Excuse Generator\n\n\n"; my @myCities = ('Baltimore','Chicago','Los Angeles','New York','San Di +ego'); my $found=0; print "Please pick one of the following cities by entering any portion + of the beginning of the city name:(@myCities)\n"; chomp(my $input_city = <STDIN> ); if ( $input_city =~ m/^l/i ) { print "We no longer tour the city of Angels, please try again\ +n"; exit; } foreach my $city ( @myCities ) { if ($city =~ /^$input_city/i ) { print "Found $city\n"; $found = 1; next; } } if ($found == 0) { print "No City found!\n"; } my %num2mon = ( "1" => "January", "2" => "February", "3" => "March", "4" => "April", "5" => "May", "6" => "June", "7" => "July", "8" => "August", "9" => "September", "10" => "October", "11" => "November", "12" => "December" ); print "Enter the month as an integer i.e. (1=January, 2=Febuary, etc.) +\n"; chomp($month = <STDIN> ); if (exists $num2mon{$month}) { #exists; } else { print "Invalid Month $month specified\n"; } print "How many days [1-31]?\n"; chomp(my $num_days = <STDIN> ); my $days = join( ", ", 1 .. $num_days ),; @myArray = ( "\nHi Steve, \n\n", "I'm looking forward to the Perl class. \n", "I just want to let you know that I won't be in class on the f +ollowing days:\n\n", "\ $num2mon{$month} $days\n\n", "I'm touring $city with my dance band, Liquid Blue!\n\n", "Thanks,\n", "Scott Stephens\n\n" ); print @myArray;

In reply to **HomeWork** Printing the found input from an array by trenchwar

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.