in reply to Convert arrayref to AoH

Can't you use a more adapted data structure giving you direct access to what you need as, for example, a simple hash? Something like this:
my %t = ( kept => 0, notkept => 0, repaired => 0, );