I want to create an eight character random ID consisting of lowercase letters and the numbers 2 to 9 (34^8= 1.7 trillion combinations). The reason I'm only using lowercase and excluding 0 and 1 is because the ids are meant to be relatively human readable, they are going to be order ids for a shopping site.
The following code does what I want, but I have this creeping feeling that there's an easier, more memory efficient way to do this. Also, using the list constructor operator with characters (a..z, A..Z) directly in the array causes my script to flame out, saying "bareword found while using strict." I think I'm just screwing up the syntax.
Thoughts?
#### Create random cart id my @seed; my $a= "a"; my $b= "z"; @seed=($a..$b,2..9); my $rand; foreach(0..7){ $rand.=$seed[rand(@seed)]; } #### end of random cart id
In reply to Random Text: There's got to be an easier way by Hero Zzyzzx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |