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

line 136 is this one from the code block:
$member_info{'person'}[0]{'salutation'} = &skip_to_cell_text( +1 ); # error on this line

It is the first time I try to assign something to a spot in the structure.

Replies are listed 'Best First'.
Re^3: Mistake in data structure use?
by chromatic (Archbishop) on Dec 01, 2006 at 23:29 UTC

    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.

      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".