in reply to Assign multiple scalars the same value
I've noticed thatThe reason it doesn't work is that my ($a,$b,$c) is, because of the (), effectively an array. Since "true" is a single element, its equivalent to doingmy ($a,$b,$c) = "TRUE";
doesn't work
my @badger="true"; foreach (@badger){print "$_\n"}
The following
my ($a,$b,$c) = ("TRUE", "TRUE", "TRUE");
works OK, because the variables on both side of the '=' are arrays - note the ()
Note that I'm not advocating using this last syntax. I agree with diotalevi that it potentially introduces a bug if you don't use enough "TRUE" values. Personally, I favour jdporters syntax, I'm just pointing out why your original failed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Assign multiple scalars the same value
by chromatic (Archbishop) on Jan 25, 2005 at 19:30 UTC |