***** infoCopter.com/perl *****
How to Generate Random PasswordsHow to generate a random password
require MIME::Base64;
use strict;
my $r = sprintf("%08d", int( (1000000000) * rand() ));
my $password = MIME::Base64::encode($r);
$password =~ tr/A-Z/a-z/;
chomp $password;
$password =~ s/[^a-z]//g; # remove other chars than alphabetic
$password =~ s/0/z/g;
$password =~ s/o/x/g;
$password =~ s/j/k/g;
$password =~ s/q/r/g;
$password =~ s/y/s/g;
$password = substr($password, 0, 6);
my @vocals = qw ( a e i u ) ;
my $rand_voc = $vocals[ int(rand() * 4) ];
substr($password, 1, 1) = $rand_voc if substr($password, 0, 1) !~ /[aeiou]/;
substr($password, 2, 1) = $rand_voc if substr($password, 1, 1) !~ /[aeiou]/;
substr($password, 3, 1) = $rand_voc if substr($password, 2, 1) !~ /[aeiou]/;
substr($password, 4, 1) = $rand_voc if substr($password, 3, 1) !~ /[aeiou]/;
$password .= sprintf("%02d", int(rand() * 99) + 1);
##### print pw
print "password => '$password'\n";
Get a random element from an arraymy @list = qw( foo bar car ); my $any = $list[rand($#list + 1)]; print "$any\n"; (From unknown source) #!/usr/bin/perl -w
print "Enter a seed number: "; $s=<STDIN>;
srand($s ^ time);
@c=split(/ */, "bcdfghjklmnprstvwxyz");
@v=split(/ */, "aeiou");
for($i = 1; $i <=4; $i += 1)
{ print $c[int(rand(20))], $v[int(rand(5))] }
|