in reply to Re: TRIM in Perl?
in thread TRIM in Perl?

I wanted the same thing I think - remove leading and trailing space, on a per line basis, ignoring newlines. I've just done this and it seems to work, i.e. linecount remains same before and after.
cat test.dat | perl -n -e 'chomp; s/^\s+//; s/\s+$//; print "$_\n";'