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

> On Mon, Sep 18, 2000 at 12:32:08PM -0400, Sam Tregar wrote:
> 
> If I grok'd the bastards, I'd write the explaination myself.

If you grok'd the bastards I bet you'd realize how useless such an
explanation would be.  The chief reason for using pack/unpack is to deal
with external binary formats.  Why would you want a description that
didn't talk about external binary formats?

> > Maybe you don't get to know how good it is until you need it?
> 
> I'm sure there are many times when pack should have been used but it
> got hacked together with something else.  The prime example is
> fixed-width data parsing.  Most people reach for substr() or a regex,
> but the best solution (as pointed out in perlfaq5) is pack.  Yet it
> still remains obtuse and I'm largely cargo-culting when I use it.

I think you're talking about unpack() here, which I've only used once.  I
think unpack() is usually replaceable by substr() or regexes.  Contrast
that with pack() for which no equivalent replacement is possible, as far
as I know.

-sam


Reply via email to