in reply to is there a more simple way to have the intersection of two lists ?

You don't have to write all that lines into an array:
my %count; while (my $line_1 = <$INFILE_1>){ $line_1 =~ s/\s+$//; $count{$line_1}++; } while (my $line_2 = <$INFILE_2>){ $line_2 =~ s/\s+$//; print $line_2, "\n" if $count{$line_2}; } # untested
  • Comment on Re: is there a more simple way to have the intersection of two lists ?
  • Download Code

Replies are listed 'Best First'.
Re^2: is there a more simple way to have the intersection of two lists ?
by ysth (Canon) on Mar 19, 2008 at 06:36 UTC