2个回答
展开全部
#hash
%hash1=("aaaa"=>1,"cccc"=>3,"bbbb"=>2,"dddd"=>4);
foreach $key(sort keys %hash1)
{
print $key;
print $hash1{$key};
print "\n";
}
%hash2 = %hash1;
print %hash2;
print "\n";
print keys %hash2;
print "\n";
print values %hash2;
print "\n";
print reverse %hash2;
print "\n";
print $hash2{aaaa};
可以看看Perl语言入门啊
%hash1=("aaaa"=>1,"cccc"=>3,"bbbb"=>2,"dddd"=>4);
foreach $key(sort keys %hash1)
{
print $key;
print $hash1{$key};
print "\n";
}
%hash2 = %hash1;
print %hash2;
print "\n";
print keys %hash2;
print "\n";
print values %hash2;
print "\n";
print reverse %hash2;
print "\n";
print $hash2{aaaa};
可以看看Perl语言入门啊
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询