Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: my and local variable significance in a particular case

by tobyink (Abbot)
on Apr 24, 2012 at 09:31 UTC ( #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
Node Status?
node history
Node Type: note [id://966768]
help
Chatterbox?
[Discipulus]: ah thanks Tux; maybe I'll try anyway: marioroy is somehow very new in the Perl world: maybe he understimated the range of antilehmanism
[Discipulus]: good monrnig Corion! and...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2017-09-20 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (234 votes). Check out past polls.

    Notices?