in reply to Re: Random Text: There's got to be an easier way
in thread Random Text: There's got to be an easier way

Beatnik nailed it, but he left out the numerals 2 through 9 and added an extra parenthesis to the second line. The exact solution is thus:
use strict; my @chars = ("a".."z","A".."Z", 2..9); my $random_string = join("",@chars[map{ rand @chars} (1..8)]); #8 being the number of chars to randomize ofcourse print "$random_string\n";

Replies are listed 'Best First'.
Re: Re: Re: Random Text: There's got to be an easier way
by Beatnik (Parson) on Jun 03, 2001 at 23:15 UTC
    The code described in the Cookbook also includes some non-alphanumeric chars...
    I'm pretty confident the code mentioned above is faster than other stuff (but then again, I didn't write it so that's normal).

    BTW you left out 1 :)

    Greetz
    Beatnik
    ... Quidquid perl dictum sit, altum viditur.