in reply to Re: Overwriting Hash / Array
in thread Overwriting Hash / Array

I'm sorry, that was something I changed before to try some things, I updated the code so it reflects exactly how it works at the moment! The @columns_import array should be outside of the named loop, you are right. Do you have any idea how to get the overwritten array fixed?

Replies are listed 'Best First'.
Re^3: Overwriting Hash / Array
by Corion (Patriarch) on Jul 28, 2015 at 08:07 UTC

    The @columns_import array is not the problem. You are modifying the %column_data_import; hash but always keep the same variable around. Most likely, the line my %column_data_import; must be moved into the loop where the different column data import schedules are held.

      If I do that, i have to put the line into the loop aswell:

      push (@columns_import, \%column_data_import);

      this results in a data structure with wrong data in it, as you can see in the Dumper result here:

      { 'IMPORT_VALUE' => '1', 'BGCOLOR_CUSTOMER' => 0, 'SCHEDULE_ROWS' => [ { 'SCHEDULE_COLUMNS_EXPORT' => [ { 'S +CHEDULE' => '20:00', 'U +NDEF' => 1 }, { 'L +INK' => 'CUSTOMERA_DOMAINA_27.07.2015_20_EXPORT.html', 'O +K' => 1, 'S +CHEDULE' => '20:00', 'U +NDEF' => 0 }, { 'L +INK' => 'CUSTOMERA_DOMAINA_26.07.2015_20_EXPORT.html', 'O +K' => 1, 'S +CHEDULE' => '20:00', 'U +NDEF' => 0 }, { 'L +INK' => CUSTOMERA_DOMAINA_25.07.2015_20_EXPORT.html', 'O +K' => 1, 'S +CHEDULE' => '20:00', 'U +NDEF' => 0 }, { 'S +CHEDULE' => '20:00', 'U +NDEF' => 1 }, { 'S +CHEDULE' => '20:00', 'U +NDEF' => 1 }, { 'S +CHEDULE' => '20:00', 'U +NDEF' => 1 } ] }, { 'SCHEDULE_COLUMNS_IMPORT' => [ { 'S +CHEDULE' => '23:21', 'U +NDEF' => 1 }, {}, {}, { 'S +CHEDULE' => '23:42', 'U +NDEF' => 1 }, {}, { 'S +CHEDULE' => '23:21', 'U +NDEF' => 1 }, {}, {}, { 'S +CHEDULE' => '23:42', 'U +NDEF' => 1 }, {}, { 'S +CHEDULE' => '23:21', 'U +NDEF' => 1 }, {}, {}, { 'S +CHEDULE' => '23:42', 'U +NDEF' => 1 }, {}, { 'S +CHEDULE' => '23:21', 'U +NDEF' => 1 }, {}, {}, { 'S +CHEDULE' => '23:42', 'U +NDEF' => 1 }, {}, { 'S +CHEDULE' => '23:21', 'U +NDEF' => 1 }, {}, {}, { 'S +CHEDULE' => '23:42', 'U +NDEF' => 1 }, {}, { 'S +CHEDULE' => '23:21', 'U +NDEF' => 1 }, {}, {}, { 'S +CHEDULE' => '23:42', 'U +NDEF' => 1 }, {}, { 'S +CHEDULE' => '23:21', 'U +NDEF' => 1 }, {}, {}, { 'S +CHEDULE' => '23:42', 'U +NDEF' => 1 }, {} ] } ], 'EXPORT_VALUE' => '1', 'DOMAIN' => 'DOMAINA', 'CUSTOMER' => 'CUSTOMERA' },