On Apr 28, 2004, at 5:01 AM, Dan Sugalski wrote:
At 3:17 AM -0700 4/28/04, Jeff Clites wrote:On Apr 23, 2004, at 2:43 PM, Dan Sugalski wrote:
For example, consider the following:
use Unicode; open FOO, "foo.txt", :charset(latin-3); open BAR, "bar.txt", :charset(big5); $filehandle = 0; while (<>) { if ($filehandle++) { print FOO $_; } else { print BAR $_; } $filehadle %= 2; }
What's the input record separator here?
The filehandle default, which depends on the encoding and character set of the input data, or so Larry's told me.
So the nature of my question here is that I assume the input record separator will be set as a string, with something similar to: $/ = "\n" or $/ = "----" or whatever.
If that's the case, presumably the user won't have to keep resetting it as they open files stored in a different encodings, if (from their point of view) they're using the same separator--they'll just set it once. But having it defined as a string would seem to imply that you'll have to transcode as you read to a common representation, in order to find the line endings. That is, if $/ was assigned "latin-1" when it was created, then you'll be forced to transcode to UTF-8 (or something) as you read, right?
JEff