|
|
|
Your skill will accomplish what the force of many cannot |
|
| PerlMonks |
Comment on |
| ( #3333=superdoc: print w/ replies, xml ) | Need Help?? |
|
I suppose it's also worth mentioning that my and our have two other friends: local and state. local sets a new, temporary value for a package variable, which expires at the end of the current scope, with the variable's original value being restored. In this example, bar() sets $::hello temporarily to "Goodbye" and this new value is visible to foo(), but after bar() has finished running, the original value of "Hello" is restored again.
And state can be used to create a variable which keeps its state, not being re-initialised.
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
In reply to Re^3: Use of "my" after Perl v5.14
by tobyink
|
|