帮我看看哪儿出错了,谢谢!

帮我看看哪儿出错了,谢谢!

帮我看看哪儿出错了,谢谢!
输入姓要求输出对应的名,可不管输入什么都输出“wrong give_name......”那句,我是perl初学者,希望高手帮帮我,谢谢!
use warnings;
%name=("jack"=>"chen","xiaolong"=>"li","ming"=>"yao");
print "please input the given_name :";
&output;
sub output{
$nm=<STDIN>;
if (exists $name{$nm}){
print $name{$nm};
}
else{
print "wrong given_name,please input a given_name from chen li or yao";
}
}
$nm=<STDIN>;--ch.
$nm=<STDIN>;
chomp $nm;
貌似错误提示信息应该是:.
貌似错误提示信息应该是:

print "wrong given_name,please input a given_name from jack xiaolong or ming";
chomp(my $nm = <>).
chomp(my $nm = <>);
输入ming,xiaolong 等正常
我把主键和值弄反了,输入.
我把主键和值弄反了,输入xiaolong 可以输出li.谢谢楼上的几位!