http://qs321.pair.com?node_id=1035785


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