Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

local doesn't bind, in my opinion.

by BlaisePascal (Monk)
on Aug 03, 2000 at 18:45 UTC ( [id://25981]=note: print w/replies, xml ) Need Help??


in reply to RE: RE: Re: YAlQ: Yet Another local() Question.
in thread YAlQ: Yet Another local() Question.

OK, I see.

Well, if I rewrite your ladd based on the transform I proposed, I get:

sub ladd($) { my $hidden_add = $add; $add = $_[ 0 ]; return sub { my $hidden_num = $num; $num = $_[ 0 ]; my $hidden_sum = $sum $sum = $num + $add; print "$num + $add = $sum\n"; ($num,$sum) = ($hidden_num,$hidden_sum); }; $add = $hidden_add; }
All the variables have global lexical scope except the hidden ones, which are never directly used. I don't see local providing any "binding" at all.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-03-28 21:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found