Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: compare two files | Help

by JavaFan (Canon)
on Mar 23, 2012 at 14:46 UTC ( [id://961221]=note: print w/replies, xml ) Need Help??


in reply to compare two files | Help

Untested:
use autodie; my %file1; my $max = 0; my $min = 0xFFFFFFFF; # Or 0xFFFFFFFFFFFFFFFFF with 64 bit ints open my $fh1, $file1; while (<$fh1>) { chomp; $min = length if $min > length; $max = length if $max < length; $file{$file1} = 1; } open my $fh2, $file2; LINE: while (<$fh2>) { for (my $l = $min; $l <= $max; $l++) { next LINE if $file{substr $_, 0, $l}; } print; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 17:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found