Greetings. I have a working script (pasted below) that uses
List::Compare to find common lines in two files.

Now I am again looking to compare two files but this time exclude any
lines in file 1 that appear in file 2. I don't see anything in the
List::Compare documentation on how to do this.

Thanks in advance for any clues on a simple way to handle this.

dn

#!/usr/bin/perl -w

use strict;
use List::Compare;

my $lfile =  $ARGV[0];
my $rfile =  $ARGV[1];
my $lc;
my @union;

# get files
open(DAT, $lfile) or die("unable to open");

my @Llist = <DAT>;

close(DAT);

open(DAT, $rfile) or die("unable to open");

my @Rlist = <DAT>;

close(DAT);

# do comparison

$lc = List::Compare->new(\...@llist, \...@rlist);

@union = $lc->get_union;

foreach my $union (@union) {
        print "$union";
}

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to