G'day Ed,
I didn't spend a huge amount of time going through your code; however, this part stood out as a potential problem:
foreach my $recid ( reverse sort %SeqOrders ) ...
That will expand all keys and values in the hash to form a list; that list will then be sorted and then reversed. Consider this minimal example of what's happening:
$ perl -MData::Dump -e '%x = qw{a 1 b 2 c 3}; dd \%x; dd { reverse sor +t %x }' { a => 1, b => 2, c => 3 } { 2 => 1, a => 3, c => "b" }
The foreach loop will set all keys and values to $recid; that will be twice the number of the keys and hence "an output file twice the size of the expected result".
You probably want something closer to:
my %rev_seq = reverse %SeqOrders; for my $recid (sort keys %rev_seq) { ... }
— Ken
In reply to Re: Building a hash from file and getting wrong result.
by kcott
in thread Building a hash from file and getting wrong result.
by flexvault
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |