toxicious has asked for the wisdom of the Perl Monks concerning the following question:
But when I am printing those new values later on in a loop, like this:for ($i=0; $i<=$#players; $i++) { my %player = %{$players[$i]}; for ($ii=0;$ii<=$#players;$ii++) { if ($i != $ii) { my %player2 = %{$players[$ii]}; if ($player{name} eq $player2{name}) { $player{deaths} += $player2{deaths}; $player{kills} += $player2{kills}; #Remove the dupe entry splice(@players, $ii, 1); } } } }
They print the old value. How do I save the values I changed them to before?my %player = %{$players[$i]}; print "$player{kills}";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Save hash value?
by chromatic (Archbishop) on Jun 05, 2011 at 22:40 UTC | |
by toxicious (Initiate) on Jun 06, 2011 at 00:03 UTC | |
by chromatic (Archbishop) on Jun 06, 2011 at 01:38 UTC | |
|
Re: Save hash value?
by Anonymous Monk on Jun 05, 2011 at 18:57 UTC | |
|
Re: Save hash value?
by ig (Vicar) on Jun 06, 2011 at 02:42 UTC | |
by toxicious (Initiate) on Jun 06, 2011 at 19:02 UTC | |
|
Re: Save hash value?
by Marshall (Canon) on Jun 06, 2011 at 06:57 UTC | |
by toxicious (Initiate) on Jun 06, 2011 at 18:57 UTC | |
by Marshall (Canon) on Jun 06, 2011 at 21:21 UTC | |
by toxicious (Initiate) on Jun 09, 2011 at 14:44 UTC | |
|
Re: Save hash value?
by ww (Archbishop) on Jun 05, 2011 at 22:03 UTC |