Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: pack question

by btrott (Parson)
on Jul 05, 2001 at 19:41 UTC ( #94133=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://94133]
help
Chatterbox?
erix likes multitail
[afoken]: and tail is part of POSIX, less isn't.
[afoken]: So tail works at every Unix's prompt, less only on a subset.

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2017-01-17 20:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (158 votes). Check out past polls.