in reply to Re^3: perl ST sort performance issue for large file?
in thread perl ST sort performance issue for large file?
Here is the modified code to my earlier code.(Earlier also I have post +ed the code and as per perl monk i have updated and posted here) use strict; use warnings; use POSIX my $file_duplicate="log_duplicate_remove"; my $file_consolidated_sort="log_consolidated_sort"; open FH_duplicate, "$file_duplicate" or die "$!"; ### input file open FH_sorting, ">>$file_consolidated_sort" or die "$!"; #### out +put file my %hash = (); my $key; my $val; while(<FH_duplicate>) { chomp; ($key,$val)=split(/,,/); $hash{$key} .= $val; } close FH_duplicate; for $key(sort keys %hash) { print FH_sorting "$key -> $hash{$key}"; } close FH_sorting;
|
|---|