|We don't bite newbies here... much|
Reconstruct binary data saved with unpack("H*", $b)by andreas1234567 (Vicar)
|on Jul 27, 2011 at 12:10 UTC||Need Help??|
andreas1234567 has asked for the
wisdom of the Perl Monks concerning the following question:
An application reads binary data from an external system, and saves it using $h = unpack("H*", $b). If I try to reconstruct the binary data with $b = pack("H*", $h), the binary data will sometimes have a trailing null byte. Is it possible to make sure the binary data as it were (i.e. never add the null byte)?
A little code sample to illustrate the problem indicates that is works when input length is even only:
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them.