in reply to Re: Referencing an array in a complex hashed data structure
in thread Referencing an array in a complex hashed data structure

There was another run-time error. But for closure, the program is executing and I am listing the end result below.

The key was realizing the the anon array was really a reference to an anon array, which clicked in the dereference mode of thought ...

if (!defined $WA{$key}) { { lock $WAlock; $WA{$key} = &share({}); #hook shared anon hash; { lock %{$WA{$key}}; $WA{$key}{PS}=$dtg; # PS period Start $WA{$key}{PE}=$dtg + $secs; # PE period End $WA{$key}{PT}=0; # PT period Total $WA{$key}{stags} = &share([]); for my $i (0..$rnds-1){ ${$WA{$key}{stags}}[$i]=0; # init all stages to 0 } } } } # end of (! defined) entry being initialized .... and ..... sub reportWA{ # $key my $key = shift; my $NewWA; unshift @{$WA{$key}{stags}}, $WA{$key}{PT}; $NewWA=$WA{$key}{PT}; # $periodTotal * 1 $#{$WA{$key}{stags}} = $rnds-1; for my $i (1..$rnds-1){ ${WA{$key}{stags}}[$i] *= $wght; #stg[n] = initial * (wght**n) $NewWA += ${WA{$key}{stags}}[$i]; } #plog sprintf "stages = %s" ,join (", ",@stgs); $NewWA /= $rnds; printf " %d %d %8.2f %s\n" , $key,$WA{$key}{PE} ,$NewWA, join (", ",@{$WA{$key}{stags}}); }
Thank you all, and the speed was amazing..