Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: **HomeWork** Printing the found input from an array

by ikegami (Patriarch)
on Apr 02, 2008 at 20:58 UTC ( [id://678042]=note: print w/replies, xml ) Need Help??


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";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://678042]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2026-02-16 02:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.