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;
|
|---|
| 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 |