#!/usr/bin/perl # -*- Mode: cperl -*- ## # Generates a 14-char long random password matching [a-zA-Z0-9] # without a command line argument, and the length you specify # otherwise. ## $len = int($ARGV[0]); $len = 14 if $len < 1; @chars = split //, "abcdefghijklmnopqrstuvwxyz" . "ABCDEFGHIJKLMNOPQRSTUVWXYZ" . "0123456789"; while ($len--) { print $chars[int(rand($#chars+1))]; } print "\n";