in reply to Re: variable like $_
in thread variable like $_
There is only one $_True.
and the second use of it destroys the contents of the first use.False.
The second use of '$_' doesn't destroy the content of the first use. It stores it somewhere else, and restores the value after the second use is finished. That's the principle of local. And that's what's happening with a foreach loop.foreach ("a", "b") { # First use of $_ foreach ("c", "d") { # Second use of $_ say; } say; # 'Old' value of $_ } __END__ c d a c d b
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: variable like $_
by CountZero (Bishop) on Feb 07, 2009 at 14:47 UTC |