in reply to how to alternate join?

A while back, I wrote Fun with join. I think it's great that you have a possible use for it. :-)

Alternatively, you could use List::Util 'reduce' to roll your own version of join that does the same thing.

use List::Util 'reduce'; my @arr = ('A'..'L'); my $per_line = 2; my $on_this_line = 0; print reduce {$a . (++$on_this_line % $per_line ? ',' : "\n") . $b} @a +rr;
or
my @arr = ('A'..'L'); my $sep = [',', "\n"]; print reduce {$a . ($sep->[@$sep] = shift @$sep) . $b} @arr;
The last works, though it's possibly too clever. What if the left @$sep is evaluated before the shift?

Caution: Contents may have been coded under pressure.