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

Hi trenchwar,
Your variable $city is lexically scoped and therefore visible only within the foreach loop.
If you need it outside the loop, define it in front of it.
... my $city; foreach $city ( @myCities ) { ...
regards rollo