in reply to placing values into bins

Would it be sensible to do something like create a hash like follows
%xy
where .. in a loop of some sort I could create the ranges, for example:
for($x = 0; $x = $max; $x++) { for($y = 0; $y = $max; $y++) { $key1 = $x; $key2 = $y; } }
Then compare my input data with the predefined ranges and increment a counter of some kind?