my @chars=("A".."Z","a".."z",0..9); my $key = join("", @chars[ map { rand @chars } ( 1 .. 25 ) ]);