http://www.perlmonks.org?node_id=939855


in reply to How to chomp the last new line character from the file

Here is one way:

perl -i -pe 'chomp if eof' file1 file2 ...

--
John.