http://www.perlmonks.org?node_id=46545


in reply to Re: (thoughts on) Detect common lines between two files, one liner from shell
in thread Detect common lines between two files, one liner from shell

Yeah, it's not an obfuscation by any means. Just a nice way to put together a lot of common features. In fact, I'd take it one step further to fulfill one additional monkey wrench thrown in after that posting was made: what if the line appears more than once in either fileA or fileB or both, but you still want only one copy of the line?

Well, the answer is just as straightforward. Remove the dollar from the regex! I'll leave that explanation as an exercise to the clever reader. {grin}

-- Randal L. Schwartz, Perl hacker


update: Bleh! My mistake, the dollar was added to handle this case! I knew I had needed to deal with multiple hits somehow.

Remind me never to post again. {grin}