This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dd12389
)
[perl #3763] code example error in "perlopentut"
author
Jarkko Hietaniemi
<jhi@iki.fi>
Fri, 5 Sep 2003 04:36:48 +0000
(
04:36
+0000)
committer
Jarkko Hietaniemi
<jhi@iki.fi>
Fri, 5 Sep 2003 04:36:48 +0000
(
04:36
+0000)
p4raw-id: //depot/perl@21040
pod/perlopentut.pod
patch
|
blob
|
blame
|
history
diff --git
a/pod/perlopentut.pod
b/pod/perlopentut.pod
index
f2ba7cd
..
5389c1f
100644
(file)
--- a/
pod/perlopentut.pod
+++ b/
pod/perlopentut.pod
@@
-625,11
+625,11
@@
just in a different process:
sub head {
my $lines = shift || 20;
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>) {
die "cannot fork: $!" unless defined $pid;
while (<STDIN>) {
- print;
last if --$lines < 0;
last if --$lines < 0;
+ print;
}
exit;
}
}
exit;
}