For the moment I only spotted an empty prototype that can cause strange behaviours: sub match_query(){.. must be sub match_query{..
from modernperlbook:
> A subroutine declared with an empty prototype (as opposed to an absent prototype) which evaluates to a single expression becomes a (compiletime ( editor’s note )) constant in the Perl 5 optree rather than a subroutine call
Anyway the Basic debugging checklist suggest to print out your data and I use this as primary, if only, debug tecnique. The principle is: know your data
The easiest thing to check is if something come up to empty in your original received hash:
sub match_query(){ my $indexfile = shift; foreach my $key(keys %$indexfile){ print "DEBUG: [$key]=>[$$indexf +ile{$key}]\n"}
Add also a debug print statement for @match_count
Instead of bare print statements you can profit of the core Data::Dumper or the better, imho, Data::Dump that you can find at CPAN.
L*
In reply to Re: Help with function, count matches and store in hash & retrieve sorted
by Discipulus
in thread Help with function, count matches and store in hash & retrieve sorted
by Pathogenomix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |