#! perl
use strict;
our $static = 'a,';
sub a { $static .= $static }
sub b { $static .= $static }
sub c { $static .= $static }
sub d { $static .= $static }
print a(); # a,
print b(); # a,a,
print c(); # a,a,a,a,
print d(); # a,a,a,a,a,a,a,a,
First, I would like to ask, is that a static var
means a var was declared inside the code itself ?
Is that what I given above related to sth what you
mensioned about ? I am not quite understand what's
the purpose there.
I mean, I don't understand why a var don't carry its
value when calling to subs, unless the var is declared
'locally'. Or are you talking about a const. value for
a var ?
Rgds,
Connie
>
> BEGIN {
>
> my $static = "abc";
>
> sub doit() {
> $static = $static x 2;
> print( "$static \n" );
> }
>
> } # end of BEGIN statement
>
> I hadn't realised that the BEGIN was required and while testing this found
> that $static was not being explicitly initalised prior to its first use.
> ---------------
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]