in reply to How do I print an array with commas separating each element?
Here's another way:
my $x = 0; printf "$array[$x-1]%s", $x <= $#array ? "," : "\n" while $array[$x++];
It puts a newline instead of a comma after the last element.
|
---|
In Section
Seekers of Perl Wisdom