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.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."
  • Comment on Re: Trying to create a fake address through random numbers and a looping issue
  • Download Code