in reply to folow up to headache with array
The cause of your problem is scoping. Just about the only variable that needs to have a wide scope ( @range_counts ) is one of the 2 or 3 that you've chosen to use my on...?
If you dropped the my on that variable, or declared it with my above the first for loop in your snippet, then your last for loop would be able to see it and it's contents.
Of course, if you re-wrote your script to use strict and use warnings, perl would have told you that the @range_counts array you are accessing in you last loop is an entirely different (global) array from the one you are creating with my inside the first set of for loops. Being lexical, this @range_counts has gone out of scope by the time you reach the second for loop.
|
|---|