如何从动态哈希中检索“密钥”?检索动态哈希的密钥
代码示例:
sub HASH($){
my %hash;
my $pass = shift;
open (my $file, '<', "infofile") || die "No such file or dir\n";
%hash=map split, <$file>;
return $hash{$pass};
}
我infofile看起来是这样的:
user passwd
raid 12345
如果发现用户的代码返回的密码。我怎样才能返回用户名?
您正在使用'$ pass'和'$ passw',其中一个可能是输入错误。 – 2013-03-06 20:28:57
安全无关紧要,只学习! – Raid5 2013-03-06 20:30:15
对不起,输入错误。 Thnaks :) – Raid5 2013-03-06 20:32:24