in reply to Mistake in data structure use?

'school' => [ 0, { 'graduation_date' => undef, 'school_name' => undef, 'school_type' => 'school' }, 1, { 'graduation_date' => undef, 'school_name' => undef, 'school_type' => 'school1' } ],
You are preceding the hashes in the array with their indexes... this is almost certainly not what you want. in square brackets items are assigned their array index by position... first is index 0, second is index 1, etc...

it should look like

'school' => [ { 'graduation_date' => undef, 'school_name' => undef, 'school_type' => 'school' }, { 'graduation_date' => undef, 'school_name' => undef, 'school_type' => 'school1' } ],

                - Ant
                - Some of my best work - (1 2 3)

Replies are listed 'Best First'.
Re^2: Mistake in data structure use?
by McLogic (Initiate) on Dec 01, 2006 at 22:34 UTC
    The part you quote and say I should change is the dump from Data::Dumper, the code is above that.

    I do really need help with this one, I worked on it all last night, but I think it is just something that I don't know and need to be pointed in the right direction.

      Data::Dumper does it like that because your code does it like that:

      school=>[ 0=>{school_type=>"school", school_name=>undef, graduation_da +te=>undef}, 1=>{school_type=>"school1", school_name=>undef, graduation_d +ate=>undef}, ],

      The other poster is suggesting you do it this way:

      school=>[ {school_type=>"school", school_name=>undef, graduation_date=> +undef}, {school_type=>"school1", school_name=>undef, graduation_date= +>undef}, ],

      However, if that's not the problem, perhaps you should tell us which line exactly is line 136. I could not tell this easily from your original post. perl's error messages tell you the line number for a reason.


      Sanity? Oh, yeah, I've got all kinds of sanity. In fact, I've developed whole new kinds of sanity. You can just call me "Mister Sanity". Why, I've got so much sanity it's driving me crazy.
        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.