http://www.perlmonks.org?node_id=997621


in reply to enoeding iso 8859 issue within a datadump

to print to a file instead of printing at the screen, we just have to change:
say $text;
to:
print $OUT_FILE $text;
Well, that's ignoring the most important distinction between say and print: that say adds a newline at the end. And you can add a filehandle argument to say. So you'd better do:
say $OUT_FILE $text;
If you set
$OUT_FILE = \*STDOUT;
or even
$OUT_FILE = select;
then you don't even have to swap code out code.

As far as your problem concerns: look at Perl I/O Layers, in particular the :utf8 and :encoding layers.

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.