You forgot to reset %h between files, so the second file will get all of the first file's lines. See my prototype answer.perl -i.bak -nlwe '$h{$_}++; if (eof) {print for sort { length($a) <=> + length($b) } keys %h}' junk.txt junk2.txt
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
In reply to •Re: Re: Using -i in oneliner with postprocessing
by merlyn
in thread Using -i in oneliner with postprocessing
by Anomynous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |