On Mon, 18 Sep 2000, Michael G Schwern wrote:

> Perhaps someone could attempt to write an explaination of pack and
> unpack in completely Perl terms.  No bits, no ints, no nybbles, no
> IEEE floating point arithmetic, no prior knowledge of C necessary.
> Those are not Perl.  Scalars, arrays, hashes, functions, methods,
> loops, contexts.  These are Perl.

"Describe to me how you use a supermarket shopping-cart in terms of a
hardware store.  Don't mention any words for food.  Just talk about nuts
and bolts."

You've pretty much nailed the primary use of pack/unpack - bridging the
gap between scalars and the various binary formats of Le Monde Cyber.

I used pack recently in order to get Perl talking with Glimpse, a search
engine written in C.  For some bizare reason the Glimpse server won't talk
to you unless you send your PID to it.  As if that weren't strange enough,
it needs your PID split into 4 bytes in reverse order.  If you can think
of a better solution to this problem than pack then by all means propose
it.  I think pack is pretty good at what it does!

Maybe you don't get to know how good it is until you need it?

-sam


Reply via email to