in reply to Re: Perl : How to Create Unique String/Number?
in thread Perl : How to Create Unique String/Number?

The time-IP combination is not repeatable
Time to what granularity? If you're talking to second-level granularity, I'll have to disagree. What about requests coming from behind a proxy? All of the internet traffic from my place of work seems to come from the same IP (and for all intents and purposes it does) regardless of the computer that's actually issuing the request. What happens when a lot of traffic is generated from one such place? If you think it can't happen, think again. Data::UUID is the way to go. Smarter people than you and I have thought about this problem and come up with that solution.

thor

Feel the white light, the light within
Be your own disciple, fan the sparks of will
For all of us waiting, your kingdom will come

  • Comment on Re^2: Perl : How to Create Unique String/Number?

Replies are listed 'Best First'.
Re^3: Perl : How to Create Unique String/Number?
by EchoAngel (Pilgrim) on Jan 27, 2005 at 22:41 UTC
    mmm, what characters should I not put because I want to generate an unique string that would be used for naming files?
      I'm not sure I understand the question. My original reply was with regards to the dangers of using time and IP address to generate a unique string. That having been said, I'll try my best to answer your question.

      There are no characters that are taboo when generating a unique string. The problem lies in generating a string that's guaranteed to be unique. Using things that shouldn't collide isn't good enough. Data::UUID guarantees no collision for the very foreseeable future. Use the solution that others have done a good job at implementing. You can have more fun in the spare time that you gain that way.

      thor

      Feel the white light, the light within
      Be your own disciple, fan the sparks of will
      For all of us waiting, your kingdom will come