develooper Front page | perl.beginners | Postings from February 2009

Re: Reading 2 array lists

Thread Previous | Thread Next
Chas. Owens
February 19, 2009 08:44
Re: Reading 2 array lists
Message ID:
On Thu, Feb 19, 2009 at 10:20, mritorto <> wrote:
> owen,
> How do you use the List::Compare module is the same as array::compare?

List::Compare can be found in CPAN*.  Here is you program rewritten to
use it (this is not what I would do):


use strict;
use warnings;
use List::Compare;

#compares directories on 2 servers
open my $atlas, "<", "atlasdirectorylisting.txt"
	or die "could not open atlasdirectorylisting.txt: $!";
open my $isis, "<", "ISISdirectorylisting.txt"
	or die "could not open ISISdirectorylisting.txt: $!";

my @atlas = <$atlas>;
my @isis  = <$isis>;

my $comparison = List::Compare->new(\@atlas, \@isis);

print $comparison->get_symmetric_difference;


Chas. Owens
The most important skill a programmer can have is the ability to read.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About