in reply to **HomeWork** Printing the found input from an array

Your variable $city is lexically scoped to the foreach loop and therefore it is visible only there. Define it before the loop to access it from outside the loop.
... my $city; foreach $city ( @myCities ) { ...

Replies are listed 'Best First'.
Re^2: **HomeWork** Printing the found input from an array
by ikegami (Patriarch) on Apr 04, 2008 at 19:44 UTC