in reply to Re: **HomeWork** Trying to search an array and match it to a user input
in thread **HomeWork** Trying to search an array and match it to a user input
my $myCities = "Baltimore:Chicago:Los Angeles:New York:San Diego:"; my @myCities = split(':', $myCities); print "Please pick one of the following cities by entering any portion + of the beginning of the city name:(@myCities)\n"; while ( my $input_city = <STDIN> ){ foreach ($input_city) { if ($input_city =~ m/^L/i ) { print "We no longer tour LA, please try again!\n"; } if ( $input_city eq $myCities ){ ### here is where im lost## print "Found\n"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: **HomeWork** Trying to search an array and match it to a user input
by kyle (Abbot) on Apr 01, 2008 at 04:27 UTC |