Variable declarations
Peter Skipworth
skip at peterskipworth.com
Thu Jan 30 17:24:21 CST 2003
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...
Cheers,
P
----- Original Message -----
From: "BONGIORNO,PAUL (HP-Australia,ex2)" <paul.bongiorno at hp.com>
To: <melbourne-pm at pm.org>
Sent: Friday, January 31, 2003 10:06 AM
Subject: Variable declarations
> Someone asked me at work if you could declare multiple variables and
> initialise them in one line for example
>
> My $a, $b, $c = 0;
>
> I realise I could do something similar like
>
> My ($a, $b, $c) = (0, 0, 0);
>
> After hearing Daimien I just didn't believe there was not a way it could
be
> done - weather or not is should be is probably another question.
>
> Thanks,
>
> Paul
>
>
>
>
More information about the Melbourne-pm
mailing list