is for you. But maybe you meant:@array = [ \($a,$b,$c) ];
Regardless, here is something to watch out for:@array = \($a,$b,$c);
I hope you see the trend. \(LIST) returns a list of references to the EXPLICIT elements of the list. \(THIS,(THAT),THOSE) returns a reference to THIS, expands THAT into a list and then takes references to each element of the list, and then a reference to THOSE. It can be icky. </code> $_="goto+F.print+chop;\n=yhpaj";F1:eval@array = (1..10); print scalar @array; # 10 $a = \@array; print $a; # ARRAY(0x12345) $b = \(@array); print $b; # SCALAR(0xabcde) # is a ref to the last element of @array) @c = \($a,@array); print @c; # SCALAR(0x13579)ARRAY(0x12345) @d = \($a,(@array)); print @d; # SCALAR(0x13579)SCALAR(0x11111)SCALAR(0x11112)...
In reply to Re: reference nastiness
by japhy
in thread \($a, $b, $c) eq (\$a, \$b, \$c), is \$a, $b, $c eq \$a, \$b, \$c?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |