bytes::substr() ?

2003-08-27 Thread ed-perluni
I'm working with a byte oriented protocol, and need to extract byte n1 through byte n2 from a string. Problem is, the string can be UTF8, and substr() is character oriented. What (if anything) is the best way to do this in Perl? Any/all ideas welcome. I would prefer a pure Perl (non XS) solution,

Re: bytes::substr() ?

2003-08-27 Thread ed-perluni
On Wed, Aug 27, 2003 at 06:04:48PM +0200, Guido Flohr wrote: > Hi, > > [EMAIL PROTECTED] wrote: > >I'm working with a byte oriented protocol, and need to extract byte n1 > >through > >byte n2 from a string. > > I read this as "*character* n1 through *character* n2", right? Alas, no -- I'm inte

use bytes

2004-05-18 Thread ed-perluni
I'm confused, can someone tell me why: #!/usr/bin/perl use bytes; $x = chr( 400 ); print "Length is ", length( $x ), "\n"; prints 1, while #!/usr/bin/perl $x = chr( 400 ); use bytes; print "Length is ", length( $x ), "\n"; prints 2? % perl -v This is perl, v