perl基础-7 (Perl编程24学时教程)

perl基础-7 (Perl编程24学时教程),第1张

概述#!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;
#!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学时教程)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1293089.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-10
下一篇 2022-06-10

发表评论

登录后才能评论

评论列表(0条)

保存