Perl Password Generator: Make Random Strings with Perl
This article will show you how to create random passwords with Perl language.
Generate Random Passwords with Perl
Using a simple Perl function, you can easily generate random strings with the characters 'A'-'Z','a'-'z', and '_', and use it as your random password for temporary password or account. The password length and characters can be easily changed to suit your needs. See how to generate random string in Perl below:
my $length_of_randomstring=shift; my @chars=('a'..'z','A'..'Z','0'..'9','_');
#Generate the random password
print "Random string: ".$random_string."\n";
Note: You can generate random passwords online using the above Perl code on http://ideone.com.
Customize Perl Random Passwords (optional)
- $length_of_randomstring: decides the length of password to be generated, specify it in generate_random_password(8).
- @chars: lets your specify what characters will be used to create random passwords. The string will be randomly selected. Differently, Perl uses '..' to indicate iterating from letter A to letter Z, while A-Z is commonly used.
Remember Perl Random Passwords
Random passwords will well protected your accounts. However, it also increase the difficulty of remembering passwords. Therefore, a password manager like Roboform is the only choice to remember these random password if you want to re-use them. With RoboForm, the Master password is the only thing you need to remember, all your secure random passwords can be accessed once entering your master password.