Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: how to speed up dupe checking of arrays

by ultibuzz (Monk)
on Jul 31, 2007 at 10:25 UTC ( [id://629789]=note: print w/replies, xml ) Need Help??


in reply to Re: how to speed up dupe checking of arrays
in thread how to speed up dupe checking of arrays

i need them in an array so i adjusted ur code like this

my @rows; my %seen; while (<IN>) { chomp; my ($ele0, $ele1, undef) = split ';', $_, 3; push @rows,"$ele0;$ele1;$file_date" if !$seen{"$ele0;$ele1 +;$file_date"}++; } close(IN);

and waht shoud i say AWSOME, from 203 seconds down do around 11 seconds,great so no over hours in office needed ;)
thx alot.

kd ultibuzz

Replies are listed 'Best First'.
Re^3: how to speed up dupe checking of arrays
by oha (Friar) on Jul 31, 2007 at 10:46 UTC
    you already have them in array.
    $seen{"$ele0;$ele1;$file_data"}++;
    then if you need the data you can, for example:
    foreach (keys %seen) { .... }
    and the value of the hash is the number of times the string is repeated

    Oha

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-03-19 09:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found