in reply to Re^5: Array/List Strangeness
in thread Array/List Strangeness
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Array/List Strangeness
by jethro (Monsignor) on Aug 05, 2009 at 13:06 UTC | |
by Taulmarill (Deacon) on Aug 05, 2009 at 13:29 UTC | |
by LanX (Saint) on Aug 05, 2009 at 16:28 UTC | |
by LanX (Saint) on Aug 05, 2009 at 16:36 UTC |