This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Typo in pod/perlfunc.pod
[perl5.git] / pod / perlfunc.pod
index e5518af..82a80de 100644 (file)
@@ -525,7 +525,7 @@ like for example images.
 
 If LAYER is present it is a single string, but may contain multiple
 directives. The directives alter the behaviour of the file handle.
-When LAYER is present using binmode on text file makes sense.
+When LAYER is present using binmode on text file makes sense.
 
 If LAYER is omitted or specified as C<:raw> the filehandle is made
 suitable for passing binary data. This includes turning off possible CRLF
@@ -1549,7 +1549,8 @@ itself.  See L</wantarray> for more on how the evaluation context can be
 determined.
 
 If there is a syntax error or runtime error, or a C<die> statement is
-executed, an undefined value is returned by C<eval>, and C<$@> is set to the
+executed, C<eval> returns an undefined value in scalar context
+or an empty list in list context, and C<$@> is set to the
 error message.  If there was no error, C<$@> is guaranteed to be a null
 string.  Beware that using C<eval> neither silences perl from printing
 warnings to STDERR, nor does it stuff the text of warning messages into C<$@>.
@@ -1735,8 +1736,7 @@ X<exists> X<autovivification>
 
 Given an expression that specifies a hash element or array element,
 returns true if the specified element in the hash or array has ever
-been initialized, even if the corresponding value is undefined.  The
-element is not autovivified if it doesn't exist.
+been initialized, even if the corresponding value is undefined.
 
     print "Exists\n"   if exists $hash{$key};
     print "Defined\n"  if defined $hash{$key};
@@ -1936,25 +1936,27 @@ perl.
 
 Here's a mailbox appender for BSD systems.
 
-    use Fcntl ':flock'; # import LOCK_* constants
+    use Fcntl qw(:flock SEEK_END); # import LOCK_* and SEEK_END constants
 
     sub lock {
-       flock(MBOX,LOCK_EX);
-       # and, in case someone appended
-       # while we were waiting...
-       seek(MBOX, 0, 2);
+       my ($fh) = @_;
+       flock($fh, LOCK_EX) or die "Cannot lock mailbox - $!\n";
+
+       # and, in case someone appended while we were waiting...
+       seek($fh, 0, SEEK_END) or die "Cannot seek - $!\n";
     }
 
     sub unlock {
-       flock(MBOX,LOCK_UN);
+       my ($fh) = @_;
+       flock($fh, LOCK_UN) or die "Cannot unlock mailbox - $!\n";
     }
 
     open(my $mbox, ">>", "/usr/spool/mail/$ENV{'USER'}")
            or die "Can't open mailbox: $!";
 
-    lock();
+    lock($mbox);
     print $mbox $msg,"\n\n";
-    unlock();
+    unlock($mbox);
 
 On systems that support a real flock(), locks are inherited across fork()
 calls, whereas those that must resort to the more capricious fcntl()
@@ -2854,7 +2856,7 @@ If EXPR is omitted, stats C<$_>.
 
 =item m//
 
-The match operator.  See L<perlop>.
+The match operator.  See L<perlop/"Regexp Quote-Like Operators">.
 
 =item map BLOCK LIST
 X<map>
@@ -4775,7 +4777,7 @@ the C<rmtree> function of the L<File::Path> module.
 
 =item s///
 
-The substitution operator.  See L<perlop>.
+The substitution operator.  See L<perlop/"Regexp Quote-Like Operators">.
 
 =item say FILEHANDLE LIST
 X<say>
@@ -5520,7 +5522,7 @@ produces the list value
 If you had the entire header of a normal Unix email message in $header,
 you could split it up into fields and their values this way:
 
-    $header =~ s/\n\s+/ /g;  # fix continuation lines
+    $header =~ s/\n(?=\s)//g;  # fix continuation lines
     %hdrs   =  (UNIX_FROM => split /^(\S*?):\s*/m, $header);
 
 The pattern C</PATTERN/> may be replaced with an expression to specify
@@ -6673,7 +6675,8 @@ Note that times for children are included only after they terminate.
 
 =item tr///
 
-The transliteration operator.  Same as C<y///>.  See L<perlop>.
+The transliteration operator.  Same as C<y///>.  See
+L<perlop/"Quote and Quote-like Operators">.
 
 =item truncate FILEHANDLE,LENGTH
 X<truncate>
@@ -7306,7 +7309,7 @@ X<wait>
 Behaves like the wait(2) system call on your system: it waits for a child
 process to terminate and returns the pid of the deceased process, or
 C<-1> if there are no child processes.  The status is returned in C<$?>
-and C<{^CHILD_ERROR_NATIVE}>.
+and C<${^CHILD_ERROR_NATIVE}>.
 Note that a return value of C<-1> could mean that child processes are
 being automatically reaped, as described in L<perlipc>.
 
@@ -7316,7 +7319,7 @@ X<waitpid>
 Waits for a particular child process to terminate and returns the pid of
 the deceased process, or C<-1> if there is no such child process.  On some
 systems, a value of 0 indicates that there are processes still running.
-The status is returned in C<$?> and C<{^CHILD_ERROR_NATIVE}>.  If you say
+The status is returned in C<$?> and C<${^CHILD_ERROR_NATIVE}>.  If you say
 
     use POSIX ":sys_wait_h";
     #...
@@ -7431,6 +7434,7 @@ Note that write is I<not> the opposite of C<read>.  Unfortunately.
 
 =item y///
 
-The transliteration operator.  Same as C<tr///>.  See L<perlop>.
+The transliteration operator.  Same as C<tr///>.  See
+L<perlop/"Quote and Quote-like Operators">.
 
 =back