![]() |
|
Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: **HomeWork** Printing the found input from an arrayby radiantmatrix (Parson) |
on Apr 02, 2008 at 14:43 UTC ( [id://677973]=note: print w/replies, xml ) | Need Help?? |
Your issue is scoping.
You've declared $city within the scope of the foreach loop. Once you leave that loop, $city goes out of scope. If you'd used strict and warnings you would have gotten a warning on that print "main::city used only once", which would have been a good clue that you might have scope issues. Simple fix? Move $city into a wider scope:
Make sense?
<–radiant.matrix–>
Ramblings and references The Code that can be seen is not the true Code I haven't found a problem yet that can't be solved by a well-placed trebuchet
In Section
Seekers of Perl Wisdom
|
|