String::MkPasswd is a Perl module that defines a single function, mkpasswd(), to generate random passwords. The function is meant to be a simple way for developers and system administrators to easily generate a relatively secure password.
The exportable mkpasswd() function returns a single scalar: a random password. By default, this password is nine characters long with a random distribution of four lower-case characters, two upper-case characters, two digits, and one non-alphanumeric character.
use String::MkPasswd qw(mkpasswd);
# for the masochisticly paranoid...
-length => 27,
-minnum => 5,
-minlower => 1, # minlower is increased if necessary
-minupper => 5,
-minspecial => 5,
-distribute => 1,