David Le Blanc wrote:
> 
> -------------- SAMPLE -------------------
> sub jack
> {
>         my $v;
> 
>         sub jill
>         {
>                 my $j = shift;
>                 print "jill: v = $v".$/;
>                 print "jill: j = $j".$/;
>                 print "jill:total = ".($v+$j).$/;
>         }
> 
>         $v = shift;
>         print "jack:v is now $v".$/;
> }
> 
> jill 3;
> jack 2;
> jill 3;
> jack 5;
> jill 3;
> ---------------- OUTPUT -----------------
> [snip]
> -----------------------------------------
> 
> Its an example of closure, and tends to make my brain hurt,
> so don't nest unless you mean it :-)

Close, but not quite a closure.

perldoc -q closure



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to