In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/c29b2abdfa0c813510d3d21b17d8a742cdefc1ad?hp=4044502721ac7b89c6d21cf1099a3a518717eeba>
- Log ----------------------------------------------------------------- commit c29b2abdfa0c813510d3d21b17d8a742cdefc1ad Author: Karl Williamson <[email protected]> Date: Wed Jul 24 09:15:01 2013 -0600 perlopentut: Fit verbatim lines into 79 columns ----------------------------------------------------------------------- Summary of changes: pod/perlopentut.pod | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pod/perlopentut.pod b/pod/perlopentut.pod index 8caef9a..b83e14a 100644 --- a/pod/perlopentut.pod +++ b/pod/perlopentut.pod @@ -223,8 +223,8 @@ This is especially handy for the handles that Perl has already opened for you. You can also pass C<binmode> an explicit encoding to change it on the fly. This isn't exactly "binary" mode, but we still use C<binmode> to do it: - binmode(STDIN, ":encoding(MacRoman)") || die "cannot binmode STDIN"; - binmode(STDOUT, ":encoding(UTF-8)") || die "cannot binmode STDOUT"; + binmode(STDIN, ":encoding(MacRoman)") || die "cannot binmode STDIN"; + binmode(STDOUT, ":encoding(UTF-8)") || die "cannot binmode STDOUT"; Once you have your binary file properly opened in the right mode, you can use all the same Perl I/O functions as you used on text files. However, @@ -239,8 +239,10 @@ Here's an example of how to copy a binary file: my($in_fh, $out_fh, $buffer); - open($in_fh, "<", $name_in) || die "$0: cannot open $name_in for reading: $!"; - open($out_fh, ">", $name_out) || die "$0: cannot open $name_out for writing: $!"; + open($in_fh, "<", $name_in) + || die "$0: cannot open $name_in for reading: $!"; + open($out_fh, ">", $name_out) + || die "$0: cannot open $name_out for writing: $!"; for my $fh ($in_fh, $out_fh) { binmode($fh) || die "binmode failed"; -- Perl5 Master Repository
