sub generate_unique_id { # Creates and returns a "random" string of 56 alphanumeric # Usage: generate_unique_id() # This includes [a-z] [A-Z] [0-9], a range of 62 characters # The random number generator is seeded elsewhere with a permutation of this child's process ID and current machine time my $buildID = md5_base64 ( rand($$) ) . md5_base64 ( rand($$) ) . md5_base64 ( rand($$) ); # Strip out "+" and "/" $buildID =~ s/\+//g; $buildID =~ s/\///g; # Truncate to fifty six characters (this is 2.4e+100 possible combinations, or approximately two googol) # It would take 187 sesvigintillion (187e+81) years at 4 billion builds/second for a conflict to arise, which makes it a fairly unique buildID return substr ($buildID, -56 ); }