@array = (a-zA-Z); foreach (20) # Set to the number of random letters you need { $rand = int(rand scalar(@array)); print "$array[$rand]"; splice(@array,$rand,1); }
no need to splice the array since it doesn't matter if characters are duplicated. not to mention if they want a string greater than 52 characters in your example it won't work.
Code:
$a.= (a..z,A..Z,0..9)[int(rand(62))] for (1..30);
-g
s/(\d{2})/chr($1)/ge + print if $_ = '8284703280698276687967';