in reply to Overwriting Hash / Array
The variable @columns_import is only declared within your 1..$scheduled_export_days loop and will be initialized anew on every trip through that loop.
A different variable of the same name is used outside of that loop.
Either you are not using the strict pragma, which would have alerted you to the situation of an undeclared variable being used, or you have declared the variable in two places.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Overwriting Hash / Array
by iRemix94 (Sexton) on Jul 28, 2015 at 08:02 UTC | |
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? | [reply] |
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. | [reply] [d/l] [select] |
by iRemix94 (Sexton) on Jul 28, 2015 at 08:18 UTC | |
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:
| [reply] [d/l] [select] |