Thread laufende Summe ueber Hash berechnen
(6 answers)
Opened by Liffi at 2012-06-19 15:29
Sowas in der Art?
Code (perl): (dl
)
1 2 3 4 5 my %hash = (1=>2, 19=>20, 38=>50, 40=>10, 60=>3, 66=>80, 700=>1); my @keylist = sort { $a <=> $b } keys %hash; for (my $x=0; $x<=$#keylist-3; $x++){ $hash{$keylist[$x]} += $hash{$keylist[$x+$_]} for (1..3); } |