Basically: an "empty" array can have any size, but an empty list always has size 0.
UPDATE: that should show it...
DB<1> @a[3..5]=() DB<2> @b[3..5]=() DB<3> print scalar @a 6 DB<4> print ( () = @a,@b ) DB<5> @c= @a,@b DB<6> print scalar @c 6 DB<7> @c=(@a,@b) DB<8> print scalar @c 12 DB<9> print ( () = (@a,@b) ) DB<10> push @a,@b DB<11> print scalar @a 12 DB<12> x @a 0 undef 1 undef 2 undef 3 undef 4 undef 5 undef 6 undef 7 undef 8 undef 9 undef 10 undef 11 undef
Line 12 clearly shows, that concatenating two "empty" arrays leads to a larger "empty" array...
Anyway the difference between line 5 and 7 is somehow surprising ...
UPDATE: Aaaaaargh!!! 8)
In line 5, I fell into the scalar comma operator trap again ... it's basically (@c=@a),(@b)
Cheers Rolf
In reply to Re^6: Array/List Strangeness
by LanX
in thread Array/List Strangeness
by Manchego
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |