in reply to Syntactically cool list of lists

push @b, [splice @a, 0, $l] while @a;

is fairly clean. Check the result with:

print "@$_\n" for @b;

DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: Syntactically cool list of lists
by sauoq (Abbot) on Dec 20, 2006 at 22:30 UTC

    Clean but destructive. So, make a copy of @a if you need to keep it.

    -sauoq
    "My two cents aren't worth a dime.";
Re^2: Syntactically cool list of lists
by jettero (Monsignor) on Dec 20, 2006 at 21:23 UTC
    That is a really cool way to do it. I always forget about splice(). I wish it didn't destroy @a, but it's definitely more readable than the map mess I figured out last night...

    -Paul