Thanks, Shlomi. On 04/04/2016 11:58 AM, Shlomi Fish wrote: [snip] >> 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.
I am looking for a way to be sure that substr always treats the data as bytes and not have to worry about it suddenly start processing the data as multiple-byte letters or something like that. So substr( $data, 8, 16 ) would always give 16 bytes from $data, starting with byte 9? > 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 [snip] >From perlunitut(1) there I gather that binary data is left as binary data and it won't trigger something to cause it being processed as unicode. Further it says that communication anything outside of the current Perl process is done in binary. So, if I am using read() to get a span of binary data, it should not only come in as binary but also stay as binary while I work with it, right? Regards, Lars -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/