Hi Lars, On Mon, 4 Apr 2016 10:54:34 +0300 Lars Noodén <lars.noo...@gmail.com> wrote:
> On 04/03/2016 02:42 PM, Shlomi Fish wrote: > > 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. > [snip] > > Thanks Duncan, Shlomi, and everyone. > > Is substr() always byte-safe? (Using perl 5.20.2 for example) > What do you mean by something being "byte-safe" exactly? I'm not sure I understand. Note that substr may return a sequence of Unicode characters if it's a Unicode string. For more information, see: * http://www.joelonsoftware.com/articles/Unicode.html * http://perldoc.perl.org/perlunitut.html Regards, Shlomi > Regards, > Lars > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/