1. # look for a specific pattern in standard input (binary or text files) and print the pattern's byte-offset:
    #!/usr/bin/perl
    open(P,"-");
    $a=join("",<P>);
    while($a =~ m/pattern/gs){
            print join(/:/,@-)."\n";
            }
    close(P); 
    
  2. # find all common lines in two files (cfr., http://perlmonks.thepen.com/36725.html):
     perl -ne 'print if ($seen{$_} .= @ARGV) =~ /10$/' fileA fileB >output