Hi,
TSa (Thomas Sandlaß <Thomas.Sandlass <at> orthogon.com> writes:
> Ingo Blechschmidt wrote:
> > say zip (@odd, @even); # &zip gets only one argument, the flattened
> > # list ( @odd, @even), containing the
>
> Why flattened? Shouldn't that be *(@odd, @even)?
IIUC:
say zip *(@odd, @even);
# &zip gets called with the parameters 1, 3, 5, 7, 2, 4, 6, 8.
say zip (@odd, @even);
# &zip gets called with one argument, (1, 3, 5, 7, 2, 4, 6, 8).
say zip ([EMAIL PROTECTED], [EMAIL PROTECTED]);
# &zip gets called with one argument, ([1, 3, 5, 7], [2, 4, 6, 8]).
In general, (@foo, @bar) returns a new list with the element joined,
i.e. "@foo.concat(@bar)". If you want to create a list with two sublists,
you've to use ([EMAIL PROTECTED], [EMAIL PROTECTED]) or ([EMAIL PROTECTED],
[EMAIL PROTECTED]). But of course, I could
be totally wrong. :)
> > # elements (1,3,5,7,2,4,6,8). Then &zip
>
> Why not ([1,3,5,7],[2,4,6,8]) list of two array refs?
Because you'd have to explicitly take reference to them:
say zip ([EMAIL PROTECTED], [EMAIL PROTECTED]).
(Can somebody confirm my thoughts?)
--Ingo