perl生成随机密码 perl生成随机密码 [root@Nagios a]# perl -le 'print map{(a..z,A..Z,0..9)[rand 64]}0..pop' 8 jm6sKgVlW
follow 没有小桥的来的爽。哈哈。
非常简洁呵呵,平时我生成密码也是这么做的。我会生成10个 然后自己挑选一个喜欢的。
#!/usr/bin/perl
use strict;
use warnings;
my @a = (0..9,’a’..’z’,’A’..’Z’,’.’,’/’,’-‘,’=’,'[‘,’;’,’#’,’!’,’$’,’%’,’*’);
my $passwd_length = 15;
sub random_passwd {
join ”, map { $a[int rand @a] } 1 .. 15;
}
for (1..10) {
print random_passwd,”\n”;
}
哈,你是正统的少林派,我属于逍遥派。。。