Don't show code closing STD{IN,OUT} before reopening, because
[p5sagit/p5-mst-13.2.git] / pod / perlopentut.pod
index f7ffa96..5389c1f 100644 (file)
@@ -602,7 +602,7 @@ welcome to reopen them if you'd like.
     open(STDOUT, "> output")
        || die "can't open output: $!";
 
-And then these can be read directly or passed on to subprocesses.
+And then these can be accessed directly or passed on to subprocesses.
 This makes it look as though the program were initially invoked
 with those redirections from the command line.
 
@@ -625,11 +625,11 @@ just in a different process:
 
     sub head {
         my $lines = shift || 20;
-        return unless $pid = open(STDOUT, "|-");
+        return if $pid = open(STDOUT, "|-");       # return if parent
         die "cannot fork: $!" unless defined $pid;
         while (<STDIN>) {
-            print;
             last if --$lines < 0;
+            print;
         } 
         exit;
     }