Another way that still uses print statements (probably less memory than storing as an array or string), would be to set up a counter initially, then print a comma at the beginning of the loop as long as the counter isn't 0.
my $counter = 0; while(...) { print ",\n" if $counter; $counter++; ... # and the rest ... }
-Bryan
In reply to Re: Don't print on the last loop
by mrborisguy
in thread Don't print on the last loop
by omega_monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |