sub generator {
my $password;
my $_rand;
my $password_length = $_[0];
if (!$password_length) {
$password_length = 10;
}
my @chars = split(" ", "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 0 9 8 7 6 5 4 3 2 1 + - _ # @ *");
srand;
for (my $i=0; $i <= $password_length ;$i++) {
$_rand = int(rand 41);
$password .= $chars[$_rand];
}
return $password;
}
# The way I would call that is : print "\n\nYour Password Is = \n\n", generator($ARGV[0]), "\n\n";
# when it's a stand alone. I wanna put it in my bot some how. The $ARGV is so they can :
# perl passgen.pl 30
# and it will print a 30 char password for them. I want this to be able to work in my bot..
# Example of a command...
elsif($input =~ /^:$owner!\S+ privmsg (\S+) :.say (\S+)$/i) {
print $sock "privmsg $1 $2";
}