CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate: Re: [Gorgarian] Need to speed up Perl script: Edit Log


Dec 18, 2012, 6:14 PM

Views: 3373
Re: [Gorgarian] Need to speed up Perl script


use strict;
use warnings;

my %temp_hash;
my @temp_array;

open my $file, '<', 'F.dump';
while (my $line = <$file>){
my($data,$hash_key) = split(/ /, $line);

$temp_hash{$hash_key} = $data if !$temp{$hash_key};

close $file;
@temp_array = keys %temp;

print "$a records from file F.dump read into linear array \n";
print " added to Female hash, now ".keys(%temp_hash)." records \n";
undef @temp_array;

try this and let me know... this will skip all keys that already exists so if you have a key of 28 in the file already and 28 around the end of the file it will skip the data of the second one.

is that all the code of the script?

(This post was edited by wickedxter on Dec 18, 2012, 6:18 PM)

Edit Log:
Post edited by wickedxter (User) on Dec 18, 2012, 6:18 PM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives