my $x; my @a = qw(one two three); print $_, ++$x<@a ? ", " : "\n" foreach @a;