For instance I want to be able to automatically localize special package vars in a code-block
sub xsub (&) { my ($code)=@_; sub { local ($a,$b) = @_; &$code; } } my $c_ref = xsub { $a ** $b }; say $c_ref->(2,3); #> 8
This looks better than sub { $_[0] ** $_[1] }
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re^2: Inspecting package vars in a sub
by LanX
in thread Inspecting package vars in a sub
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |