in reply to Re: Re: How do I safely, portably extract one or more bytes from a string?
in thread How do I safely, portably extract one or more bytes from a string?

I'm pretty sure that using a reference to an integer as the record separator is strictly a byte oriented operation. At least the following still reads one byte at a time (though length reports 1 character as expected):

my $string = chr(400); print length($string),"\n"; local $/=\1; open FH, "<", \$string or die $!; while (my $byte = <FH> ) { print "<$byte>\n"; } close FH;
  • Comment on Re: Re: Re: How do I safely, portably extract one or more bytes from a string?
  • Download Code

Replies are listed 'Best First'.
Re: Re: Re: Re: How do I safely, portably extract one or more bytes from a string?
by BrowserUk (Patriarch) on Nov 29, 2003 at 13:44 UTC

    That's almost exactly identical code that I tried last night before posting, but I apparently saw what I wanted to see:(

    Seems like an error or ommision in the unicode support, but .... davido++ got it right.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Hooray!
    Wanted!