Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: remove entries that match

by mickeyn (Priest)
on Jul 12, 2007 at 07:09 UTC ( #626154=note: print w/ replies, xml ) Need Help??


in reply to remove entries that match

'remaining 90' is relevant to 100 unique names in FILE2.
assuming, that's not exactly what you meant (remaining can be lower than 90 if there are repetitions in FILE2), this code should work for you:

use strict; use Tie::File; # read first file open my $fh, '<', 'FILE1' or die "can't open FILE1\n"; chomp(my @file1 = <$fh>); close $fh; # remove from second file tie my @file2, 'Tie::File', 'FILE2' or die "can't open FILE2\n"; foreach my $x (@file1) { @file2 = grep {!/^$x$/} @file2; } untie @file2;

HTH,
Mickey


Comment on Re: remove entries that match
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://626154]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2014-08-01 23:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (51 votes), past polls