programming-examples/perl/SystemFunction/Generate random password.pl

15 lines
331 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/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";