in reply to Re^2: Overwriting Hash / Array
in thread Overwriting Hash / Array
I've refactored your code slightly and I hope you can see how the act loop is setting the same hash element each time. Add the $debug variable to see. What structure do you want ?
pojforeach my $i ( 1 .. $scheduled_export_days ){ my %column_data_export; my %column_data_import; $column_data_export{SCHEDULE} = $schedule_hour; $column_data_export{UNDEF} = 1; my $debug=0; for my $act (@{$bi->{$customer}->{$domain}->{$host}->{BACKUPDATA}}){ + ++$debug; my $imp_exp_type = $act->{ACTION_TYPE}; my $imp_exp_status = $act->{STATUS}; my @schedule_time = split(/:/, $schedule_hour); my $minutes_range = ($schedule_time[1]+30) % 60; # import code if ($imp_exp_type eq "IMPORT"){ my ($imp_formated_hour,undef) = hhmm($act->{ENDDATE_SEC},$unit) $column_data_import{SCHEDULE} = $imp_formated_hour; $column_data_import{UNDEF} = $debug ;#1 ; } # export code } push (@columns_export, \%column_data_export); push (@columns_import, \%column_data_import); } sub hhmm { my ($s,$unit) = @_; my @tmp = split / /,$unit->formatDateTime($s); my ($hr,$min) = split /:/, $tmp[1]; return ("$hr:$min",$tmp[0]); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Overwriting Hash / Array
by iRemix94 (Sexton) on Jul 28, 2015 at 10:48 UTC | |
by poj (Abbot) on Jul 28, 2015 at 11:49 UTC | |
by iRemix94 (Sexton) on Jul 28, 2015 at 12:08 UTC | |
by poj (Abbot) on Jul 28, 2015 at 18:49 UTC |