summaryrefslogtreecommitdiff
path: root/pod/perlopentut.pod
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-07-24 09:15:01 -0600
committerKarl Williamson <public@khwilliamson.com>2013-07-24 09:21:27 -0600
commitc29b2abdfa0c813510d3d21b17d8a742cdefc1ad (patch)
treeb9bb5150b5dd4d5c7cf2d9dab5be05dc0fae3875 /pod/perlopentut.pod
parent4044502721ac7b89c6d21cf1099a3a518717eeba (diff)
downloadperl-c29b2abdfa0c813510d3d21b17d8a742cdefc1ad.tar.gz
perlopentut: Fit verbatim lines into 79 columns
Diffstat (limited to 'pod/perlopentut.pod')
-rw-r--r--pod/perlopentut.pod10
1 files changed, 6 insertions, 4 deletions
diff --git a/pod/perlopentut.pod b/pod/perlopentut.pod
index 8caef9a67e..b83e14a253 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";