in reply to Using -i in oneliner with postprocessing

The trick is that you need to be on the last line when you're printing the output. Here's a simple reverser to show how it works:
perl -ni.bak -e 'push @a, $_; if (eof) { print reverse @a; @a = () }' +file1 file2 file3
This reverses each of the contents of the files in place. Note that eof becomes true on the last line of each file, not just the last line of all files.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.