You're right! I was misinterpreting the prefixed count. That's both good and bad news.
As in it packs/unpacks a list of data reliably.
Which want the prefix to be a count of the bytes in the packet; not the number of fields.
That means an extra step is required:
$p = pack 'N/a*', pack '(n/a*)*', 1..10, 'aaaa'..'aaaz';; %h = unpack '(n/a*)*', unpack 'N/a*', $p;; pp \%h;; { 1 => 2, 3 => 4, 5 => 6, 7 => 8, 9 => 10, aaaa => "aaab", aaac => "aaad", aaae => "aaaf", aaag => "aaah", aaai => "aaaj", aaak => "aaal", aaam => "aaan", aaao => "aaap", aaaq => "aaar", aaas => "aaat", aaau => "aaav", aaaw => "aaax", aaay => "aaaz", }
That's cool, but important to know.
In reply to Re^2: Mystery! Logical explanation or just Satan's work?
by BrowserUk
in thread Mystery! Logical explanation or just Satan's work?
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |