sub make_binary
{
my $vars = shift;
return eval "sub { $vars; }";
}
I understand the mechanism of the closure, but I don't figure out how
the anonymous subroutine puts the two arguments in $_[0] and in $_[1] ?
Its evaling a string and $vars is being interpolated so the eval, in
that example is just like:
return eval 'sub { $_[0] + $_[1] }';
which ends up being just like
return sub { $_[0] + $_[1] };
after the eval :)
HTH
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>