If the code is not terribly complex, you can always use join. If it is, consider pulling out the last element (with pop) and saving it for after the loop. You will most likely want to encapsulate the body of the loop into a subroutine. Something like this:
my $last = pop @tables; foreach my $table (@tables) { process($dbh,$table); print ",\n"; } process($dbh,$last);
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re: Don't print on the last loop
by jeffa
in thread Don't print on the last loop
by omega_monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |