Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: What are pack/unpack used for?

by DrHyde (Prior)
on Jun 11, 2012 at 11:10 UTC ( #975539=note: print w/replies, xml ) Need Help??

in reply to What are pack/unpack used for?

If you ever need to deal with binary data, or with fixed width records, then pack/unpack may be useful tools and should be considered.

That doesn't mean that they'll always be the *best* tool for the job as they have some annoying limitations and the documentation is somewhat, umm, opaque, but you should certainly consider them, and if you decide to use something else you should be able to justify it. Remember - TIMTOWTDI,BMOTAWMOTT,ESOTT (but most of them are wrong most of the time, essential some of the time).

For example, I mostly don't use them in Data::Hexdumper because I want to support 64 bit data on 32 bit platforms.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://975539]
[jdporter]: omg, I f love Perl!
[choroba]: say unpack 'H*', pack 'B*', $mask =~ /0b([01]+)/;
[choroba]: use C instead of H to get the decimal number
[erix]: ( no love like f love )
[choroba]: f* love

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2018-02-20 16:35 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (272 votes). Check out past polls.