in reply to Odd number of elements in anonymous hash!

You probably intended the hash ref constructor to read:
{$data[0]{'xml_api_reply'}{'weather'}{'report_date'}->{'-data'} => $to +day,}
(Changed the = to =>)

             I hope life isn't a big joke, because I don't get it.
                   -SNL

Replies are listed 'Best First'.
Re^2: Odd number of elements in anonymous hash!
by Anonymous Monk on Aug 19, 2012 at 18:07 UTC
    If I do what that thats what I am getting:
    push @data, {$data[0]{'xml_api_reply'}{'weather'}{'report_date'}->{'-d +ata'} => $today,};

    Use of uninitialized value in anonymous hash ({}) at add_to_array.pl line 28.
      It is not clear if you are trying to push a SCALAR or HASHREF into @data.

      If you want a SCALAR, take out the outermost {}, and use an assignment instead of my recommended =>.

      You may want to remove the "push" statement from the code entirely, because with it, you are entering the same information twice, into @data.

                   I hope life isn't a big joke, because I don't get it.
                         -SNL

        I am trying to do is to add extra data in there "report_date". At the end I would like to have my file looked like this:
        $VAR1 = [ { 'xml_api_reply' => { '-version' => '1', 'weather' => { 'report_date' => { '-d +ata' => '08-19-2012 @ 15:40:26' }, '-row' => '0', 'current_conditions' = +> { + 'icon' => { + '-data' => '/ig/images/weather/mostly_cloudy.gif' + }, + 'temp_f' => { + '-data' => '70' + }, + 'temp_c' => { + '-data' => '21' + }, + 'wind_condition' => { + '-data' => 'Wind: E at 7 mph' + }, + 'humidity' => { + '-data' => 'Humidity: 65%' + }, + 'condition' => { + '-data' => 'Mostly Cloudy' + } + }, } } }, ];

        Thanks!