http://qs321.pair.com?node_id=36725
Description: A challenge was made in comp.unix.shells for a short program to detect common lines in both fileA and fileB, printing one copy of each of common lines. Of course, this was a natural one-liner in Perl, but I stumbled across a bizarre way which I though you might appreciate.
perl -ne 'print if ($seen{$_} .= @ARGV) =~ /10$/' fileA fileB >output