#!usr/bin/perl -w#hash%hash1=("aaaa"=>1,"bbbb"=>2,"cccc"=>3,"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};print "\n";print "sort","\n";@arraykeys = values %hash2;for $k (@arraykeys){ print $k;}print "sort1","\n";foreach (sort {$b<=>$a} @arraykeys) #{$b<=>$a} 数字排序{ print "$_";}print "sort2","\n";foreach (sort {$a<=>$b} @arraykeys){ print "$_";}#########################################print "\n","local,my our","\n";sub changenumber{ $foo = 100; }sub main{ my $foo = 0; &changenumber; print '$foo=',$foo;}&main;总结
以上是内存溢出为你收集整理的perl基础-7 (Perl编程24学时教程)全部内容,希望文章能够帮你解决perl基础-7 (Perl编程24学时教程)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)