in reply to Shorter ID Codes

Is there a pre-written function to do this in Perl?

Yes there is. Someone asked a similar question a week ago and I suggested that they use Math::BaseCalc.

You just have to choose the characters you want to use, for instance 0..9 and A..Z give you 36 digit values, and so you could convert your base-10 ids into base-36. You could go to base-64 but then you'd have to say "uppercase g, lowercase r" which would be a net loss.

The process is reversable, just convert from base 36 back to base 10.

- another intruder with the mooring of the heat of the Perl

Replies are listed 'Best First'.
Re^2: Shorter ID Codes
by Fletch (Bishop) on Oct 28, 2004 at 19:02 UTC

    Of course if you use A..Z then you may introduce confusion between 0 => O and I => 1.

    Update: Good point below, although you could mitigate that by reading it back using a phonetic alphabet (papa delta bravo tango), but again that'd take longer.

      I'm going to echo this and add that purely numbered IDs are much easier to hear. There is tremendous aural confusion around B & D & P & T etc, even among speakers with the same accent. You might find that while 4242 4242 4242 4242 takes longer to read it's a false economy to switch it out with something like PDBT.