xoot
Got xoot?
Welcome to the MacOSX.com Perl Association. This iss where you get to post your perl scripts.
Here is one of mine:
Have fun!
Here is one of mine:
Code:
#!/usr/bin/perl
#
# rpass - random password generator
#
# by xoot
use strict;
srand;
my ($password, @chars, $length);
@chars = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'.', '/', '$', '#', '@', '!', '%', '^', '&', '*', '(', ')', '-', '=', '+', '_', '|', '<', '>', '?', '\\');
if (@ARGV == 1) {
$length = $ARGV[0];
} else {
print "Enter password length: ";
chomp($length = <STDIN>);
}
if ($length =~ /[^0-9]/) {
print "Invalid length.\n";
exit(1);
}
while ($length != 0) {
$length--;
$password .= $chars[rand(@chars)];
}
print "Password: " . $password . "\n";
Have fun!
