Generating random passwords with Perl

While performing some house cleaning this evening, I came across the following Perl nugget:


my @alphanumeric = ('a'..'z', 'A'..'Z', 0..9);
my $randpassword = join '', map $alphanumeric[rand @alphanumeric], 0..8;
print "$randpasswordn"

This awesome little 3-line script will produce random 8-character alphanumeric passwords:



I wish I knew where I grabbed this from so I could publicly thank the author.

This article was posted by Matty on 2005-09-15 18:27:00 -0400 EDT