Hi Lars and all,
On Thu, 31 Mar 2016 11:38:44 +0000
Duncan Ferguson <[email protected]> wrote:
> Lars,
>
> I believe 'unpack' is the right way to go, you just need to get the template
> right ('N' in your example)
>
in addition to unpack there are also:
1. http://perldoc.perl.org/functions/vec.html - perldoc -f vec.
2. http://perldoc.perl.org/functions/substr.html - perldoc -f substr - should
work fine on byte-based data.
3. https://metacpan.org/release/Data-ParseBinary - inspired by
https://pypi.python.org/pypi/construct and reportedly not too performant.
Regards,
Shlomi Fish
> See the explanation on http://www.perlmonks.org/?node_id=224666, especially
> the section on 'unpack'
>
> "unpack takes a template string and a scalar and returns a list of values."
>
> ($order_time, $monk, $itemname, $quantity, $ignore) =
> unpack( "l i Z32 s2", $rec );
>
> Duncs
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/