in reply to problem while reading multiple files

Assuming order isn't important:
$ comm -12 <(sort file1) <(sort file2)
No perl needed.

Replies are listed 'Best First'.
Re^2: problem while reading multiple files
by JavaFan (Canon) on Jul 13, 2010 at 15:24 UTC
    And a Perl solution that does the same:
    use File::Slurp; my @a1 = sort {$a cmp $b} read_file shift; my @a2 = sort {$a cmp $b} read_file shift; while (@a1 && @a2) { my $cmp = $a1[0] cmp $a2[0]; print $a1[0] if !$cmp; shift @a1 if $cmp <= 0; shift @a2 if $cmp >= 0; }