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 reply to Re: How do I print an array with commas separating each element?
by turnstep
in thread How do I print an array with commas separating each element?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |