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.