in reply to Reading two files, cmp certain cols
You created a hash %file1, but then didn't use it as a hash
# foreach my $key (sort keys %file1){ # foreach my $position1 (@{$file1{$key}}){ # if ($current_line[0] eq $key) { if (exists $file1{current_line[0]} ) { $key= $current_line[0]; foreach my $position1 (@{$file1{$key}}){
Both versions above should be equivalent (except for the sorting of the keys), but the second version removes a loop.
The conditions don't contribute much to the runtime, no need to optimize them
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reading two files, cmp certain cols
by sesemin (Beadle) on Sep 19, 2008 at 02:27 UTC | |
by sesemin (Beadle) on Sep 19, 2008 at 16:40 UTC | |
by jethro (Monsignor) on Sep 19, 2008 at 23:39 UTC | |
by sesemin (Beadle) on Sep 20, 2008 at 20:36 UTC | |
by jethro (Monsignor) on Sep 21, 2008 at 00:50 UTC | |
by Cristoforo (Curate) on Sep 20, 2008 at 23:17 UTC |