in reply to Re^5: to loop through an array
in thread to loop through an array and store each of the subtotals in the elements of another array
Second, if not every key gets hit, then some elements will never be initialized. You can fix this either by initializing all elements in %count to zero before the loop ($count{$_} = 0 for @findle;) or limit your output to cycling over keys where you got hits:
for my $element (sort keys %count) { print "$element\t=>$count{$element}\n"; }
|
|---|