in reply to Re: Using -i in oneliner with postprocessing
in thread Using -i in oneliner with postprocessing

perl -i.bak -nlwe '$h{$_}++; if (eof) {print for sort { length($a) <=> + length($b) } keys %h}' junk.txt junk2.txt
You forgot to reset %h between files, so the second file will get all of the first file's lines. See my prototype answer.

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