Hello,
about closure I read the
Perl literacy course
lecture #9 Closures
Shlomo Yona http://cs.haifa.ac.il/~shlomo/
The explanations are clear but in this example:
(it's an excerpt of an example of Shlomo)
#!/usr/bin/perl
use warnings;
use strict;
my $sumform = make_binary('$_[0] + $_[1]');
print "7 + 8 = ", $sumform -> (7, 8), "\n";
print "5 + 3 = ", $sumform -> (5, 3), "\n";
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] ?
tia
--
Gérard
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>