in reply to Trying to create a fake address through random numbers and a looping issue
If the problem is ensuring that your fake addresses are always unique, why not just append an incrementing number from within the script?
my $uniq = 0; sub create_random { my @chars = ( "A" .. "Z", "a" .. "z", 0 .. 9, qw(! @ $ % ^ & *) ); my $user_name = join("", @chars[ map { rand @chars } ( 1 .. 10 ) ]) +; return $user_name . $uniq++; }
If you need to keep the uniqueness across runs, store a single field for the number in the DB, query it when the script starts and store it before you exit.
|
|---|