Mega Code Archive

 
Categories / Perl / System Functions
 

Generate random passwords

#!/usr/local/bin/perl -w     use Getopt::Long;     GetOptions ('l|length=i');     my $length = $opt_l || 8;     my $password = "";     my $x = 0;     srand (time|$$);     for ($x=0; $x < $length; $x++){         my $intval = 50;         $password .= sprintf ("%c", $intval);     }     print "Password $password \n";