Always use 3-argument open
Always use open my $fh, '<:encoding(utf8)', $filename or die ..., the 3-argument version of open, and never the old way.
Note the open call has 3 parameters:
- The holder of the file-handle which has been just created. open will assign the file-handle to it.
- The mode of open. (to read, to write, to append, etc.)
- Supply the encoding (utf8 in our case).
- Path to the file.
Comment to the experts
In the rare cases when you must use the old version, you'll know it.
Published on 2014-04-06
If you have any comments or questions, feel free to post them on the source of this page in GitHub. Source on GitHub.
Comment on this post