in reply to Re^2: zero fill with pack
in thread zero fill with pack
what is the significance of the ", 0," in the "pack('NN', 0, $_)" statement?
The value for the first "N".
Q=654848 ----------------------- 00 00 00 00 00 09 fe 00 ----------- ----------- N=0 N=654848
I also need to pad the above value with two spaces, i.e., "00 00 00 00 00 09 fe 00 20 20"
More concisely, you want to add two spaces. pack:
C An unsigned char (octet) value. A A text (ASCII) string, will be space padded.
pack('NN CC', 0, $_, ord(' '), ord(' ')) pack('NN CC', 0, $_, 0x20, 0x20) pack('NN A2', 0, $_, ' ') pack('NN n', 0, $_, 0x2020)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: zero fill with pack
by Spooky (Beadle) on Jun 23, 2010 at 16:54 UTC | |
|
Re^4: zero fill with pack
by Spooky (Beadle) on Jun 25, 2010 at 13:21 UTC | |
by Spooky (Beadle) on Jun 25, 2010 at 15:28 UTC |