On Tue, Apr 16, 2002 at 03:58:53PM -0400, Chas Owens wrote:
> The idea behind this sub is that $static gets incremented each time you
> call the subroutine. If that is not what you want then yes, the if-else
> is not needed. In that case you would want to say something like:
>
> sub sub1 {
>
On Tue, 2002-04-16 at 15:51, Elias Assmann wrote:
> On 16 Apr 2002, Chas Owens wrote:
> > sub has_a_static_var {
> > #declare a "static" variable
> > my $static if 0;
> >
> > if (defined $static) { $static++ }
> > else { $static = 0 }
> >
> > #do stuff
> > }
>
On 16 Apr 2002, Chas Owens wrote:
> sub has_a_static_var {
> #declare a "static" variable
> my $static if 0;
>
> if (defined $static) { $static++ }
> else { $static = 0 }
>
> #do stuff
> }
May I ask why you do this if-else thing here? It seems super
On Tue, 2002-04-16 at 14:01, richard noel fell wrote:
> If in a subroutine, I have a statements
>
> sub
> {
>
> my $local_var=1
>
>
>
> $local_var=$local_var+1;
>
>
> }
> then the next time I run this subroutine, $local_var is reinitialized to
> 1. However, I would like to have it r
on Tue, 16 Apr 2002 18:01:28 GMT, Richard Noel Fell wrote:
> If in a subroutine, I have a statements
>
> sub
> {
>
> my $local_var=1
>
>
>
> $local_var=$local_var+1;
>
>
> }
> then the next time I run this subroutine, $local_var is reinitialized to
> 1. However, I would like to hav