Blame view

tools/scripts/intersec.pl 403 Bytes
e6be5137b   Jean-François Rey   reinitialized pro...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  #!/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;
  	}
  }