intersec.pl
403 Bytes
#!/usr/bin/perl -w
my %intersecTab;
for(my $i =0; $i <= $#ARGV; $i++){
my $file;
open($file, "$ARGV[$i]") or die("Cannot open : $ARGV[$i]");
my %hash; @hash{<$file>} = 1;
my @uniqContent = sort keys %hash;
for(my $y=0; $y <= $#uniqContent; $y++){
$intersecTab{$uniqContent[$y]}++;
}
close($file);
}
while(my ($value, $count) = each %intersecTab){
if($count == @ARGV){
print $value;
}
}