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