my @arr = ('A'..'L'); my $sep = [',', "\n"]; print reduce {$a . ($sep->[@$sep] = shift @$sep) . $b} @arr;