Hi Lars and all,

On Thu, 31 Mar 2016 11:38:44 +0000
Duncan Ferguson <duncan.fergu...@opsview.com> 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: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to