in reply to Howto count elements within an interval

my $bucketIndex = int(($position-1) / 1e6);