Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Array loop is very inefficient, 100% CPU usage

by jdporter (Paladin)
on Oct 06, 2004 at 14:56 UTC ( [id://397008]=note: print w/replies, xml ) Need Help??


in reply to Array loop is very inefficient, 100% CPU usage

(Updated)
my %diff; my %new; open F, "< $old_file" or die "read $old_file: $!"; while (<F>) { chomp; my( $cid, $date, $avs ) = split /::/; $diff{"$cid::$date"}{$avs}++; } close F; open F, "< $new_file" or die "read $new_file: $!"; while (<F>) { my( $cid, $date, $avs ) = split /::/; my $key = join '::', $cid, $date; $diff{$key}{$avs}++; $new{$key} = $_; } close F; while ( my( $key, $val_hr ) = each %diff ) { keys %$val_hr > 1 and $data .= $new{$key}; }

Log In?
Username:
Password:

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

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

    No recent polls found