> Yet, I still not find anything on pack can do something like that :
> 
> $binarydata = pack "H*', $ascii_str;
> $ascii_str = unpack "H*", $binarydata;

I think you have it backwards. You fisrt want to *unpack* your string into
Hex, than *pack* it back to ascii using the same template. Remember, at the
low level, your text string is really an array of bytes ( going back to it's
C roots)
Try this:

$str = 'foo';
($bin) = unpack "H*", $str;
$ascii = pack 'H*', $bin;
print $ascii;

Pack and unpack can be very tricky. It took me a while to learn how to use
them properly, in fact I still struggle with it. vec() is even more
squirrelly



Thanks
JIm





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.760 / Virus Database: 509 - Release Date: 9/10/2004
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to