open(3p) Perl Programmers Reference Guide open(3p)
open(3p) Perl Programmers Reference Guide open(3p) # open(3p) Perl Programmers Reference Guide open(3p) NNAAMMEE # open - perl pragma to set default PerlIO layers for input and output SSYYNNOOPPSSIISS # use open IN => ':crlf', OUT => ':raw'; open my $in, '<', 'foo.txt' or die "open failed: $!"; my $line = <$in>; # CRLF translated close $in; open my $out, '>', 'bar.txt' or die "open failed: $!"; print $out $line; # no translation of bytes close $out; use open OUT => ':encoding(UTF-8)'; use open IN => ':encoding(iso-8859-7)'; use open IO => ':locale'; # IO implicit only for :utf8, :encoding, :locale use open ':encoding(UTF-8)'; use open ':encoding(iso-8859-7)'; use open ':locale'; # with :std, also affect global standard handles use open ':std', ':encoding(UTF-8)'; use open ':std', OUT => ':encoding(cp1252)'; use open ':std', IO => ':raw :encoding(UTF-16LE)'; DDEESSCCRRIIPPTTIIOONN # Full-fledged support for I/O layers is now implemented provided Perl is configured to use PerlIO as its IO system (which has been the default since 5. ...