A: 如何找到2在 hash 表值当中呢? #!/usr/bin/perl %x = ('a' => 1, 'b' => 2, 'c' => 3); 给出几种方法: 1. my %reverse = reverse %x; if( defined( $reverse{2} ) ) { print "2 is a value in the hash!/n"; } 2.找出键盘key的值. foreach my $key ( keys %x ) { print "2 is the value for $key/n" if $x{$key} == 2; } 3.使用 list类 use List::MoreUtils qw(any); if (any { $_ == 2 } values %x) { print "Found!/n"; } 4.Shorter answer using smart match: use List::MoreUtils qw(any); if (any { $_ == 2 } values %x) { print "Found!/n"; }