大佬教程收集整理的这篇文章主要介绍了生成随机字符串,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
#! perl use Strict; use warnings; my $type=3; my $length=8; my $count=3; my @base_char=(); #1 my @number=(0..9); #2 my @low_char=('a'..'z'); #4 my @big_char=('A'..'Z'); #8 my @other_char=('`','~','!','@','#','$','%','^','&','*','(',')','-','_','=','+','[','{','}',']','\\','|',';',':','"','\'',','<','>','.','/','?'); @[email protected] if($type==1); @[email protected]_char if($type==2); @base_char=(@number,@low_char) if($type==3); @[email protected]_char if($type==4); @base_char=(@number,@big_char) if($type==5); @base_char=(@low_char,@big_char) if($type==6); @base_char=(@number,@low_char,@big_char) if($type==7); @[email protected]_char if($type==8); @base_char=(@number,@other_char) if($type==9); @base_char=(@low_char,@other_char) if($type==10); @base_char=(@number,@other_char) if($type==11); @base_char=(@big_char,@other_char) if($type==12); @base_char=(@number,@big_char,@other_char) if($type==13); @base_char=(@low_char,@other_char) if($type==14); @base_char=(@number,@other_char) if($type==15); my @random_str=(); for(1..$count){ my $str=join '',map {@base_char[int rand @base_char]} 0..($length-1); push(@random_str,$str) } print "@random_str\n";
以上是大佬教程为你收集整理的生成随机字符串全部内容,希望文章能够帮你解决生成随机字符串所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。