首页 > 试题广场 >

以下Perl程序的输出结果是什么? my %hash =(

[单选题]
以下Perl程序的输出结果是什么?

my %hash =(

   'eye' => '2',

   'nose’' => '1',

   'mouth' => '3',

   'ear’'  => '4',

);

my @keys = sort {$hash{$b} <=> $hash{$a}} keys(%hash);

print "@keys";

  • 1 2 3 4
  • ear mouth eye nose

  • eye nose mouth ear

  • 2 1 3 4
按照values的降序对keys排序
发表于 2022-08-06 11:30:51 回复(0)