in reply to Random letters

Pretty much the same way you do random numbers, I'd think:
my @letters = ('a'..'z'); my $random_letter = $letters[int rand @letters];
If you wanted capitals, as well:
my @letters = ('a'..'z', 'A'..'Z'); print $letters[int rand @letters], "\n";

Replies are listed 'Best First'.
RE: Re: Random letters
by turnstep (Parson) on Apr 12, 2000 at 19:20 UTC

    Actually, you don't even need the 'int' - it just slows things down. Faster still, store the number of elements in the array into a scalar:

    @letters=(A..Z,a..z); $total=@letters; $newletter = $letters[rand $total];