in reply to Algoritm for converting string to number?
A computer internally stores all data in bytes, so you could just interpret those bytes as an integer.
unpack (see also: pack and perlpacktut) can help you here:
$ perl -wE 'say unpack "q", "abcdefgh"' 7523094288207667809
But note that this leads to rather large integers, 8 charaters (with codepoints up to 255) text fit into an unsigned 64 bit int.
If the strings are larger than that, it might be necessary to create a persistent lookup table, where you assign integer values to string labels, and look them up in there.
|
|---|