in reply to Counter - number of tags per interval

From what I can see your code is not only hard to read but also conceptually wrong.

Your using the 3rd level of %hash_pos at the same time for indicating the interval stop

foreach my $o (keys %{$hash_pos{$id}->{$p}}){ $hash_stop{$p}->{$o}=1;

AND for counting

             $hash_pos{$id}->{$keyu}->{$key}++ if $2 eq '1';

Thats why each count is interpreted as a new stop, resulting in exponentially growing run-time!

As another consequence the results should be plain wrong.

Did you check them before posting?

Update

Not sure anymore, this code is really too hard to read!

Please try more descriptive and consistent variable names!

Cheers Rolf

( addicted to the Perl Programming Language)