in reply to Re: **HomeWork** Printing the found input from an array
in thread **HomeWork** Printing the found input from an array
Make sense?
Not really. There are now two variables named city (one localized to the loop and a new one in the outer scope), and one of them is always undef.
The purpose of the loop is to validate $inner_city, so why is $city being printed? Fix:
foreach my $city ( @myCities ) { # $city is local to this loop only! } print "$inner_city";
|
|---|