Cristoforo (++) is right.
A few more pieces of advice:
- use strict;. If you did, it would have told you that "$count" was not valid.
- Do not pre-pend your called subroutine names with &. There is old fashioned, and there are a few esoteric reasons for using it (Beyond the scope of this note).
- Your "$max_bits" can be initialized to zero - that is probably more understable to the lay reader than having to explain why you start at 60.
I hope life isn't a big joke, because I don't get it.
-SNL