Kevin Pfeiffer wrote:
>
> I would have thought that this would initialize my $indent variable to 2
> (like setting an initial state for an object), but if I call "indent()" I
> get nothing back. :-(
>
>
> {  # static local variable
>    my $indent = 2;
>
>    sub indent {
>       my $increment = shift;
>       $indent += $increment if $increment;
>       return $indent;
>    }
> }

By the way, that's not a closure! It's just a subroutine
with a non-volatile local variable.

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to