Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: how to print out side of foreach loop($k1 $a{$k1}) ?

by davido (Cardinal)
on May 29, 2013 at 06:16 UTC ( #1035785=note: print w/replies, xml ) Need Help??


in reply to how to print out side of foreach loop($k1 $a{$k1}) ?

If you want $k1, $k2, and $k3 to still be in scope after the loops terminate, declare them at a broader lexical scope than the confines of the loops. The only way to print them after the loops terminate is for them to still be in scope after the loops terminate, which means they have to be declared outside of the loops.


Dave

  • Comment on Re: how to print out side of foreach loop($k1 $a{$k1}) ?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2020-11-23 17:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?