in reply to Re: appending arrays
in thread appending arrays

That will get the data off the end of @array2, not the beginning. Use shift instead of pop.

Update: Nothing to see here. Move along. (Must read more carefully next time).

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

: () { :|:& };:

Note: All code is untested, unless otherwise stated

Replies are listed 'Best First'.
Re: Re: Re: appending arrays
by Not_a_Number (Prior) on Nov 19, 2003 at 20:57 UTC
    That will get the data off the end of @array2, not the beginning.

    Err... Isn't that what the OP wanted? It works fine for me with the OP's data. OK, it destroys @array2, as Abigail-II pointed out. Just for fun, here's a solution that destroys both of the original arrays:

    die "Arrays of different lengths" unless @array1 == @array2; my @array3 = map { shift ( @array1 ) . pop ( @array2 ) } @array1;

    dave