Re: initializing a closure variable

2003-10-29 Thread Rob Dixon
Kevin Pfeiffer wrote: > > In article <[EMAIL PROTECTED]>, Rob Dixon wrote: > > > 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. :-( > >> >

Re: initializing a closure variable

2003-10-28 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Rob Dixon wrote: > 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

Re: initializing a closure variable

2003-10-27 Thread Rob Dixon
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 = sh

Re: initializing a closure variable

2003-10-26 Thread Rob Dixon
Kevin Pfeiffer wrote: > > In article <[EMAIL PROTECTED]>, Rob Dixon wrote: > > > 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. :-( > [...]

Re: initializing a closure variable

2003-10-26 Thread Rob Dixon
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 = sh

Re: initializing a closure variable

2003-10-26 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Rob Dixon wrote: > 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. :-( [...] > Well yes, it will, but only when you

Re: initializing a closure variable

2003-10-26 Thread Jeff 'japhy' Pinyan
On Oct 26, Kevin Pfeiffer said: >> { >> my $indent = 2; >> >> sub indent { >> my $increment = shift; >> $indent += $increment if $increment; >> return $indent; >> } >> } > >Hmmm, I guess I would have to move it up or add a "BEGIN" label. Using a BEGIN block isn't a bad idea; jus