Perl sorting hash by values in the hash

后端 未结 2 1429
梦如初夏
梦如初夏 2021-01-28 08:42

I think I have the right idea but there\'s some syntax/convention thing I\'m messing up, because I get the error \"Global symbol %timeHash requires explicit package name\".

2条回答
  •  北海茫月
    2021-01-28 09:05

    use List::UtilsBy qw( rev_nsort_by );
    
    foreach my $key ( rev_nsort_by { $timeHash{$_} } keys %timeHash ) {
        ...
    }
    

提交回复
热议问题