Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: my and local variable significance in a particular case

by tobyink (Canon)
on Apr 24, 2012 at 09:31 UTC ( [id://966768]=note: print w/replies, xml ) Need Help??


in reply to my and local variable significance in a particular case

$x = "x"; $y = "y"; sub uc_call { my $x = uc $x; local $y = uc $y; shift->(); } my $code = sub { print "$x $y\n" }; uc_call($code);

The above prints lower-case "x" but upper-case "Y", which illustrates that even without strictures, there's a difference between local and my.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-23 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found