也许我是愚蠢的,但这对我来说没有意义......我通过从众多文件中读取唯一代码和错误代码来构建哈希.当我尝试打印出key = value对时,除非紧接着是换行符,否则键不会出现.
这是代码:
foreach my $key (keys %codehash){
print "Key: $key\tValue: $codehash{$key}\n";
print "Key: $key\n";
print "Value: $codehash{$key}\n";
print "\n\n";
}
Run Code Online (Sandbox Code Playgroud)
这是输出:
Value: NoParamSpecified
Key: 016C
Value: NoParamSpecified
Value: billingAddress.firstName.lengthLong
Key: 003M
Value: billingAddress.firstName.lengthLong
Value: billingAddress.address1.lengthLong
Key: 0041
Value: billingAddress.address1.lengthLong
Run Code Online (Sandbox Code Playgroud)
请注意,它甚至不打印第一个语句中的"Key:"纯文本,只显示选项卡及更高版本.我以前从未见过这个.