/ Published in: Perl
Usage: perl script.pl length
Expand |
Embed | Plain Text
#!/usr/bin/perl # Script: Random password generator # Fri 03 Dec 2010 01:30:24 PM CET #use strict; # List of chars. Modify this if you need to add more, like simbols, etc... u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 ); # The array of the password. my @password = (""); # Select a random char from the array @chars and introduced into the array @password. sub pass_gen { my $add_char = $chars[$rand]; } # The length of the password. If none is supplied externally, given the value of 8. # Call the function pass_gen X (the value stored in $lenght) times. for (my $x = 1; $x <= $length; $x++) { &pass_gen(); } # Print the password without spaces. print "Here is your password:\n"; #End of file
You need to login to post a comment.
