http://qs321.pair.com?node_id=94133


in reply to pack question

"Printing the ASCII chars" is not really equivalent to "converting to hex". Which do you want? :)

If you want to print out 324789 as the binary representation of a long (in network order), for example, do this:

print pack "N", 324789;
Say instead that you want to print it out in hex; then you can do this:
print unpack "H*", pack "N", 324789;
Or you could use printf with the %x specifier.