Below is code that I found on the web that I slightly modified. I am trying
to create a script to remove from a file (tlist) the items in another file
(tnames). This works but I have multiple files (tlist) I need to check
against. I'm not sure how/where to put the loop and would appreciate any
help. I am also wondering why the hash ? Does it work better in  the script
than an array and what are the keys in this case as the files (both) are
just lists of e-mail addresses. 

#!/bin/perl

my %compare = ();
open (file1, "/usr/local/tools/tnames") or die "$!";
while (<file1>) {
        chomp;
        $compare{$_}++;
}
close(file1);

open (file2, "/usr/local/tools/tlist") or die "$!";
while (<file2>) {
        chomp;
        push @missing,$_ unless (exists($compare{$_}));;
}
close(file2);
#print "$_\n" for @missing;

open (file3, ">/usr/local/tools/tlist1") or die "$!";
print file3 join("\n",@missing);
print file3 ("\n");
close (file3);


TIA

-- 

Karyn Williams
Network Services Manager
California Institute of the Arts
[EMAIL PROTECTED]
http://www.calarts.edu/network

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to