in reply to Using -i in oneliner with postprocessing

The inside-out braces are really freaky. Also, your solution won't work for multiple input files, while this will:
perl -i.bak -nlwe '$h{$_}++; if (eof) {print for sort { length($a) <=> + length($b) } keys %h; %h=();}' junk.txt junk2.txt
Update: D'oh! I knew to do that! Thanks, Merlyn.

The PerlMonk tr/// Advocate

Replies are listed 'Best First'.
•Re: Re: Using -i in oneliner with postprocessing
by merlyn (Sage) on Apr 28, 2004 at 15:44 UTC