> perl -wnle "print qq(Files remaining ) . @ARGV; print $seen{$_} .= @ARGV; " file1 file2 file3 #### #!perl -w use strict; my %seen; sub intersect { # see perlfaq4 }; my $first_file = shift @ARGV; my @common = read_file($first_file); for (@ARGV) { @common = intersect( \@common, [ read_file $_ ] ); }; print "$_\n" for @common;