[VPM] Iterating through a dynamic array
nkuipers
nkuipers at uvic.ca
Fri Jun 4 17:01:15 CDT 2004
Thanks for the ideas. As always, KISS. Working across 2 data structures is
messy. So I
went down to 1, and it was almost too simple from there...I think...it seems
to be doing
what I want anyway...although maybe not too elegant...
use constant { LIMIT => 0.90 };
my %sequence = ();
my $pid = 1;
...
# populate the hash with $pid++ as keys, sequence refs as values
...
for my $i (1..$pid-1) {
for my $j (1..$pid-1) {
if ($i == $j) { next } # same sequence
if (!exists $sequence{$i} || !exists $sequence{$j}) { next } #
already deleted
if ((similarity ${ $sequence{$i} }, ${ $sequence{$j} }) > LIMIT) {
delete $sequence{$j}; # keep "first copy"
}
}
Have a great weekend,
Nathanael
More information about the Victoria-pm
mailing list