Quick and dirty, check if you're at the end of file:
use warnings; use strict; open my $fh, '<', 'file.txt' or die "can't open the damned file!: $!"; while (<$fh>){ chomp; if (! eof){ print "$_,\n"; } else { print "$_\n"; } }
Where 'file.txt' contains:
one two three
Output:
one, two, three
In reply to Re: remove a comma
by stevieb
in thread remove a comma
by luupski
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |