in reply to String to Hex

Well, the problem is that each "F" in the hex representation represents 4 bits, and you can only express a value that fits within 32 bits (8 * 4) using the  printf( "%x", ... ) approach. (I even tried using  "%lx" just now, and got the same result -- just 32 bits.)

I guess you'll need to have your perl interpreter compiled to handle 64-bit ints, or maybe use Math::BigInt, or else roll your own logic for handling values from the database that don't fit into 32 bits.