in reply to Re: Inspecting package vars in a sub
in thread Inspecting package vars in a sub
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
|
|---|