in reply to Re^2: Mistake in data structure use?
in thread Mistake in data structure use?

The error message is exactly right. The first element of the array reference you've assigned to person is the value 0, which is not a hash reference. It's a plain scalar value. In Perl, you don't assign pairs of indices and values to arrays. Perl will automatically use the correct index numbers when you assign a list to an array.

Do what the first commenter suggested and your code will work better.

Replies are listed 'Best First'.
Re^4: Mistake in data structure use?
by McLogic (Initiate) on Dec 04, 2006 at 16:31 UTC
    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".