in reply to Pack & Unpack
When you use the 'i/A*' format on pack the 'i/'part is requesting pack to prefix the string with a 4-byte integer denoting the length of the following string. This is the "garbage" you are seeing. To remove this, use the same format on the unpack as you used on the pack.
print pack 'i/A*', "1;SS\015" ♣ 1;SS print unpack 'A*', pack 'i/A*', "1;SS\015" ♣ 1;SS print unpack 'i/A*', pack 'i/A*', "1;SS\015" 1;SS
Or don't include it in the first place if you don't need it?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Pack & Unpack
by perlplexer (Hermit) on Apr 16, 2003 at 15:28 UTC |