Do not assign the reference to your structure to an array (@AoH) but to a scalar. Putting an array creates an extra level of an array in it which you do not need. Use Data::Dumper to see this.
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law