Variable declarations

Stas Bekman stas at stason.org
Thu Jan 30 19:05:42 CST 2003


Peter Skipworth wrote:
> my $a = my $b = my $c = 1;
> 
> That works and is perfectly valid AFAIK, as is my ($a, $b, $c)=(1,1,1);
> 
> I don't think there's any shorter way of doing it properly...
> 
> $a = $b = $c = 1 also works, but assumes your vars have already been
> declared of course...

/home/stas> perl -lwe 'my($a, $b, $c) = (0) x 3; print "$a $b $c"'
0 0 0

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas at stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




More information about the Melbourne-pm mailing list