Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated, and a little bit messy -LW  Using
pack to evaluate text strings as hexadecimal values  by davis
(Vicar) on Mar 07, 2006 at 12:47 UTC
( #534899=perlquestion: print w/ replies, xml ) Need Help??
davis has asked for the wisdom of the Perl Monks concerning the
following question:   I've been writing some code to trundle
through Mozilla Thunderbird's mbox format (with an eventual aim
to copying all the folder structure and the emails to an IMAP
server), and I've come up against the following problem. I think
this is where my lack of a computer science education fails me.
I'm trying to parse the X-Mozilla-Status field, which is stored
as a string. I've thought of prepending a "0x" and evaling the
result, but, after reading Pack/Unpack Tutorial (aka How the
System Stores Data) I thought I should be able to do this with
pack.  #!/usr/bin/perl use warnings; use strict; use
Data::Dumper; my $string = "0002"; my $MSG_FLAG_READ