in reply to Don't print on the last loop

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