You all were right about the error from the beggining. When I use 0=>{} insted of just {}, I make two entries in my array. One entry is "0" and the other is the anon hash (under index 1). When I try to use index 0 as a hash ref, I get my error as index 0 is just "0".