Anno was right, that's not a closure. Here's the typical example of a closure:
#!/usr/bin/perl use strict; use warnings; my $plus_5 = adder( 5 ); my $plus_10 = adder( 10 ); print $plus_5->(2), "\n"; print $plus_10->(3), "\n"; sub adder { my $base = shift; return sub { $base + shift; } }
In reply to Re: calling from outside the closure a sub defined in a closure
by derby
in thread calling from outside the closure a sub defined in a closure
by spx2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |