[thelist] can someone explain perl's pack/unpack to me?

Benjamin C. Varadi bvaradi at nlcnet.org
Tue Oct 29 11:47:25 CST 2002


http://www.sleepycat.com/docs/ref/dumpload/format.html
"If the backslash character precedes another backslash character, it means
that a literal backslash character occurred in the key or data item. If the
backslash character precedes any other character, the next two characters
must be interpreted as hexadecimal specification of a single character; for
example, \0a is a newline character in the ASCII character set.

The problem is, I know enough about perl to know that unpack should be used,
but not enough to know how.  I tried reading the file in line by line, &
unpacking each line (tried h2 & A2), and both ways got "36" as the output
for the line.

I realize my lack of understanding could make this a really unpleasant
thread to follow.  Can someone just point me towards references for dealing
with files, pack & unpack that may be a little easier to follow than the
manual pages?  I don't want to learn the entire language, just wanna come up
with a quick hack.

-BEN


----- Original Message -----
From: "Dean Mah" <dmah at members.evolt.org>
To: <thelist at lists.evolt.org>
Sent: Tuesday, October 29, 2002 10:38 AM
Subject: Re: [thelist] can someone explain perl's pack/unpack to me?


> You need to know the format of a dbm dump to know how to unpack it.
> What are you using now as the template to unpack?  Are you sure that
> is how the binary data is formatted?





More information about the thelist mailing list