in reply to how to alternate join?

You know how some questions just keep tickling your brain for more solutions? This is one of those. Look, Ma! No temp variables!
sub pairs { map {join ',', splice(@_, 0, 2)} 0..$#_/2 } print join("\n", pairs(@arr)), "\n";
That reads pretty nice. I'm going to say that's my final answer, Regis.

Update: replaced an awkward map with a nice splice.


Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: how to alternate join?
by SamCG (Hermit) on May 05, 2005 at 18:24 UTC
    beautiful! Thank you all -- some questions seem lead you to things far better than the actual answer itself. I feel like that here.