我有一个日历,上面充斥着每天的上班时间。我喜欢每天整理小时数。.我已经计算了小时数。
loop....
# $daguren 1..31
# uren = sum of all the daily hours
$daguren{$dag} += $workedhours;
...loop
# i like to sort it on "daguren" that is a number 1 .. 31
while (($dag,$uren)=each %daguren){
print "dag=$dag uren=$uren<br>\n";
}
您要遍历键
# This sorts by working hours
my @sorted_keys = sort { $daguren{$a} <=> $daguren{$b} } keys %daguren;
# This sorts by date
my @sorted_keys = sort { $a <=> $b } keys %daguren;
foreach my $dag ( @sorted_keys )
{
my $uren = $daguren{$dag};
print "dag=$dag uren=$uren<br>\n";
}