"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.

In reply to Re: pack question by btrott
in thread pack question by dash2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":