in reply to Pack/unpack irregularity
Instead of
sprintf "%1x", $var;
use
sprintf "%2x", $var;
This will give two nybbles (a full byte) so pack and unpack give the expected answer.
Update: Changed bytes to nybbles - Doh!
Update 2: ++ greenFox for pointing out the why.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Pack/unpack irregularity
by greenFox (Vicar) on May 30, 2002 at 01:17 UTC | |
by thor (Priest) on May 30, 2002 at 03:40 UTC |