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 {
> my $static if 0;
> #this line is not necessary unless you need
> #a default value for you static variable
> $static = "DEFAULT" unless defined $static;
>
> #do something
> }
I just noticed this conversation, so forgive me if this has already been
mentioned. The static variable you're using is a misfeature of perl, and
could very well disappear or change shape in a future version. I would not
suggest relying on this in production code.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]