mention unpack('pP',...) footshot (from Albert Dvornik <bert@genscan.com>)
[p5sagit/p5-mst-13.2.git] / pod / perlfunc.pod
index 370353b..a65e3e3 100644 (file)
@@ -12,11 +12,12 @@ operators take more than one argument, while unary operators can never
 take more than one argument.  Thus, a comma terminates the argument of
 a unary operator, but merely separates the arguments of a list
 operator.  A unary operator generally provides a scalar context to its
-argument, while a list operator may provide either scalar and list
+argument, while a list operator may provide either scalar or list
 contexts for its arguments.  If it does both, the scalar arguments will
 be first, and the list argument will follow.  (Note that there can ever
-be only one list argument.)  For instance, splice() has three scalar
-arguments followed by a list.
+be only one such list argument.)  For instance, splice() has three scalar
+arguments followed by a list, whereas gethostbyname() has four scalar
+arguments.
 
 In the syntax descriptions that follow, list operators that expect a
 list (and provide list context for the elements of the list) are shown
@@ -47,6 +48,11 @@ example, the third line above produces:
     print (...) interpreted as function at - line 1.
     Useless use of integer addition in void context at - line 1.
 
+A few functions take no arguments at all, and therefore work as neither
+unary nor list operators.  These include such functions as C<time>
+and C<endpwent>.  For example, C<time+86_400> always means
+C<time() + 86_400>.
+
 For functions that can be used in either a scalar or list context,
 nonabortive failure is generally indicated in a scalar context by
 returning the undefined value, and in a list context by returning the
@@ -56,7 +62,7 @@ Remember the following important rule: There is B<no rule> that relates
 the behavior of an expression in list context to its behavior in scalar
 context, or vice versa.  It might do two totally different things.
 Each operator and function decides which sort of value it would be most
-appropriate to return in a scalar context.  Some operators return the
+appropriate to return in scalar context.  Some operators return the
 length of the list that would have been returned in list context.  Some
 operators return the first value in the list.  Some operators return the
 last value in the list.  Some operators return a count of successful
@@ -135,10 +141,8 @@ C<unlink>, C<utime>
 
 =item Keywords related to the control flow of your perl program
 
-C<caller>, C<continue>, C<die>, C<do>, C<dump>, C<else>, C<elsif>,
-C<eval>, C<exit>, C<for>, C<foreach>, C<goto>, C<if>, C<last>,
-C<next>, C<redo>, C<return>, C<sub>, C<unless>, C<wantarray>,
-C<while>, C<until>
+C<caller>, C<continue>, C<die>, C<do>, C<dump>, C<eval>, C<exit>,
+C<goto>, C<last>, C<next>, C<redo>, C<return>, C<sub>, C<wantarray>
 
 =item Keywords related to scoping
 
@@ -211,10 +215,10 @@ C<dbmclose>, C<dbmopen>
 
 =head2 Portability
 
-Perl was born in UNIX and therefore it can access all the common UNIX
-system calls.  In non-UNIX environments the functionality of many
-UNIX system calls may not be available or the details of the available
-functionality may be slightly different.  The Perl functions affected
+Perl was born in Unix and can therefore access all common Unix
+system calls.  In non-Unix environments, the functionality of some
+Unix system calls may not be available, or details of the available
+functionality may differ slightly.  The Perl functions affected
 by this are:
 
 C<-X>, C<binmode>, C<chmod>, C<chown>, C<chroot>, C<crypt>,
@@ -226,13 +230,13 @@ C<getppid>, C<getprgp>, C<getpriority>, C<getprotobynumber>,
 C<getprotoent>, C<getpwent>, C<getpwnam>, C<getpwuid>,
 C<getservbyport>, C<getservent>, C<getsockopt>, C<glob>, C<ioctl>,
 C<kill>, C<link>, C<lstat>, C<msgctl>, C<msgget>, C<msgrcv>,
-C<msgsnd>, C<open>, C<pipe>, C<readlink>, C<select>, C<semctl>,
+C<msgsnd>, C<open>, C<pipe>, C<readlink>, C<rename>, C<select>, C<semctl>,
 C<semget>, C<semop>, C<setgrent>, C<sethostent>, C<setnetent>,
 C<setpgrp>, C<setpriority>, C<setprotoent>, C<setpwent>,
 C<setservent>, C<setsockopt>, C<shmctl>, C<shmget>, C<shmread>,
-C<shmwrite>, C<socketpair>, C<stat>, C<symlink>, C<syscall>,
-C<sysopen>, C<system>, C<times>, C<truncate>, C<umask>, C<utime>,
-C<wait>, C<waitpid>
+C<shmwrite>, C<socket>, C<socketpair>, C<stat>, C<symlink>, C<syscall>,
+C<sysopen>, C<system>, C<times>, C<truncate>, C<umask>, C<unlink>,
+C<utime>, C<wait>, C<waitpid>
 
 For more information about the portability of these functions, see
 L<perlport> and other available platform-specific documentation.
@@ -309,15 +313,14 @@ reasons may be for example network filesystem access controls, ACLs
 (access control lists), read-only filesystems, and unrecognized
 executable formats.
 
-Also note that, for the superuser on the local filesystems, C<-r>,
-C<-R>, C<-w>, and C<-W> always return 1, and C<-x> and C<-X> return 1
+Also note that, for the superuser on the local filesystems, the C<-r>,
+C<-R>, C<-w>, and C<-W> tests always return 1, and C<-x> and C<-X> return 1
 if any execute bit is set in the mode.  Scripts run by the superuser
 may thus need to do a stat() to determine the actual mode of the file,
-or temporarily set the uid to something else.
+or temporarily set their effective uid to something else.
 
 If you are using ACLs, there is a pragma called C<filetest> that may
 produce more accurate results than the bare stat() mode bits.
-
 When under the C<use filetest 'access'> the above-mentioned filetests
 will test whether the permission can (not) be granted using the
 access() family of system calls.  Also note that the C<-x> and C<-X> may
@@ -371,7 +374,7 @@ If VALUE is omitted, uses C<$_>.
 
 Accepts an incoming socket connect, just as the accept(2) system call
 does.  Returns the packed address if it succeeded, FALSE otherwise.
-See example in L<perlipc/"Sockets: Client/Server Communication">.
+See the example in L<perlipc/"Sockets: Client/Server Communication">.
 
 =item alarm SECONDS
 
@@ -388,8 +391,12 @@ starting a new one.  The returned value is the amount of time remaining
 on the previous timer.
 
 For delays of finer granularity than one second, you may use Perl's
-C<syscall()> interface to access setitimer(2) if your system supports it,
-or else see L</select()>.  It is usually a mistake to intermix C<alarm()>
+four-arugment version of select() leaving the first three arguments
+undefined, or you might be able to use the C<syscall()> interface to
+access setitimer(2) if your system supports it.  The Time::HiRes module
+from CPAN may also prove useful.
+
+It is usually a mistake to intermix C<alarm()>
 and C<sleep()> calls.
 
 If you want to use C<alarm()> to time out a system call you need to use an
@@ -431,32 +438,40 @@ L<perlipc/"Sockets: Client/Server Communication">.
 =item binmode FILEHANDLE
 
 Arranges for the file to be read or written in "binary" mode in operating
-systems that distinguish between binary and text files.  Files that are
-not in binary mode have CR LF sequences translated to LF on input and LF
-translated to CR LF on output.  Binmode has no effect under Unix; in MS-DOS
-and similarly archaic systems, it may be imperative--otherwise your
-MS-DOS-damaged C library may mangle your file.  The key distinction between
-systems that need C<binmode()> and those that don't is their text file
-formats.  Systems like Unix, MacOS, and Plan9 that delimit lines with a single
-character, and that encode that character in C as C<"\n">, do not need
-C<binmode()>.  The rest need it.  If FILEHANDLE is an expression, the value
-is taken as the name of the filehandle.
+systems that distinguish between binary and text files.  Files that
+are not in binary mode have CR LF sequences translated to LF on input
+and LF translated to CR LF on output.  Binmode has no effect under
+many sytems, but in MS-DOS and similarly archaic systems, it may be
+imperative--otherwise your MS-DOS-damaged C library may mangle your file.
+The key distinction between systems that need C<binmode()> and those
+that don't is their text file formats.  Systems like Unix, MacOS, and
+Plan9 that delimit lines with a single character, and that encode that
+character in C as C<"\n">, do not need C<binmode()>.  The rest may need it.
+If FILEHANDLE is an expression, the value is taken as the name of the
+filehandle.
+
+If the system does care about it, using it when you shouldn't is just as
+perilous as failing to use it when you should.  Fortunately for most of
+us, you can't go wrong using binmode() on systems that don't care about
+it, though.
 
 =item bless REF,CLASSNAME
 
 =item bless REF
 
-This function tells the thingy referenced by REF that it is now
-an object in the CLASSNAME package--or the current package if no CLASSNAME
-is specified, which is often the case.  It returns the reference for
-convenience, because a C<bless()> is often the last thing in a constructor.
-Always use the two-argument version if the function doing the blessing
-might be inherited by a derived class.  See L<perltoot> and L<perlobj>
-for more about the blessing (and blessings) of objects.
+This function tells the thingy referenced by REF that it is now an object
+in the CLASSNAME package.  If CLASSNAME is omitted, the current package
+is used.  Because a C<bless()> is often the last thing in a constructor.
+it returns the reference for convenience.  Always use the two-argument
+version if the function doing the blessing might be inherited by a
+derived class.  See L<perltoot> and L<perlobj> for more about the blessing
+(and blessings) of objects.
 
-Creating objects in lowercased CLASSNAMEs should be avoided.  Such 
-namespaces should be considered reserved for Perl pragmata and objects
-that may be created to implement internal operations.
+Consider always blessing objects in CLASSNAMEs that are mixed case.
+Namespaces with all lowercase names are considered reserved for
+Perl pragmata.  Builtin types have all uppercase names, so to prevent
+confusion, you may wish to avoid such package names as well.  Make sure
+that CLASSNAME is a true value.
 
 See L<perlmod/"Perl Modules">.
 
@@ -499,9 +514,9 @@ previous time C<caller()> was called.
 
 =item chdir EXPR
 
-Changes the working directory to EXPR, if possible.  If EXPR is
-omitted, changes to home directory.  Returns TRUE upon success, FALSE
-otherwise.  See example under C<die()>.
+Changes the working directory to EXPR, if possible.  If EXPR is omitted,
+changes to the user's home directory.  Returns TRUE upon success,
+FALSE otherwise.  See the example under C<die()>.
 
 =item chmod LIST
 
@@ -524,14 +539,16 @@ successfully changed.  See also L</oct>, if all you have is a string.
 
 =item chomp
 
-This is a slightly safer version of L</chop>.  It removes any
-line ending that corresponds to the current value of C<$/> (also known as
+This safer version of L</chop> removes any trailing string
+that corresponds to the current value of C<$/> (also known as
 $INPUT_RECORD_SEPARATOR in the C<English> module).  It returns the total
 number of characters removed from all its arguments.  It's often used to
 remove the newline from the end of an input record when you're worried
-that the final record may be missing its newline.  When in paragraph mode
-(C<$/ = "">), it removes all trailing newlines from the string.  If
-VARIABLE is omitted, it chomps C<$_>.  Example:
+that the final record may be missing its newline.  When in paragraph
+mode (C<$/ = "">), it removes all trailing newlines from the string.
+When in slurp mode (C<$/ = undef>) or fixed-length record mode (C<$/> is
+a reference to an integer or the like, see L<perlvar>) chomp() won't
+remove anything.  If VARIABLE is omitted, it chomps C<$_>.  Example:
 
     while (<>) {
        chomp;  # avoid \n on last field
@@ -609,8 +626,9 @@ restrictions may be relaxed, but this is not a portable assumption.
 
 Returns the character represented by that NUMBER in the character set.
 For example, C<chr(65)> is C<"A"> in either ASCII or Unicode, and
-chr(0x263a) is a Unicode smiley face (but only within the scope of a
-C<use utf8>).  For the reverse, use L</ord>.
+chr(0x263a) is a Unicode smiley face (but only within the scope of
+a C<use utf8>).  For the reverse, use L</ord>.  
+See L<utf8> for more about Unicode.
 
 If NUMBER is omitted, uses C<$_>.
 
@@ -642,10 +660,10 @@ counter (C<$.>), while the implicit close done by C<open()> does not.
 If the file handle came from a piped open C<close()> will additionally
 return FALSE if one of the other system calls involved fails or if the
 program exits with non-zero status.  (If the only problem was that the
-program exited non-zero C<$!> will be set to C<0>.)  Also, closing a pipe 
-waits for the process executing on the pipe to complete, in case you
-want to look at the output of the pipe afterwards.  Closing a pipe
-explicitly also puts the exit status value of the command into C<$?>.
+program exited non-zero C<$!> will be set to C<0>.)  Closing a pipe 
+also waits for the process executing on the pipe to complete, in case you
+want to look at the output of the pipe afterwards, and 
+implicitly puts the exit status value of that command into C<$?>.
 
 Example:
 
@@ -679,14 +697,14 @@ L<perlipc/"Sockets: Client/Server Communication">.
 =item continue BLOCK
 
 Actually a flow control statement rather than a function.  If there is a
-C<continue> BLOCK attached to a BLOCK (typically in a L</while> or
-L</foreach>), it is always executed just before the conditional is about to
-be evaluated again, just like the third part of a L</for> loop in C.  Thus
+C<continue> BLOCK attached to a BLOCK (typically in a C<while> or
+C<foreach>), it is always executed just before the conditional is about to
+be evaluated again, just like the third part of a C<for> loop in C.  Thus
 it can be used to increment a loop variable, even when the loop has been
 continued via the C<next> statement (which is similar to the C C<continue>
 statement).
 
-L</last>, L</next>, or L</redo> may appear within a C<continue>
+C<last>, C<next>, or C<redo> may appear within a C<continue>
 block. C<last> and C<redo> will behave as if they had been executed within
 the main block. So will C<next>, but since it will execute a C<continue>
 block, it may be more entertaining.
@@ -705,8 +723,6 @@ Omitting the C<continue> section is semantically equivalent to using an
 empty one, logically enough. In that case, C<next> goes directly back
 to check the condition at the top of the loop.
 
-See also L<perlsyn>.
-
 =item cos EXPR
 
 Returns the cosine of EXPR (expressed in radians).  If EXPR is omitted,
@@ -759,13 +775,13 @@ for it is unwise.
 
 =item dbmclose HASH
 
-[This function has been superseded by the C<untie()> function.]
+[This function has been largely superseded by the C<untie()> function.]
 
 Breaks the binding between a DBM file and a hash.
 
 =item dbmopen HASH,DBNAME,MODE
 
-[This function has been superseded by the C<tie()> function.]
+[This function has been largely superseded by the C<tie()> function.]
 
 This binds a dbm(3), ndbm(3), sdbm(3), gdbm(3), or Berkeley DB file to a
 hash.  HASH is the name of the hash.  (Unlike normal C<open()>, the first
@@ -798,6 +814,13 @@ See also L<AnyDBM_File> for a more general description of the pros and
 cons of the various dbm approaches, as well as L<DB_File> for a particularly
 rich implementation.
 
+You can control which DBM library you use by loading that library
+before you call dbmopen():
+
+    use DB_File;
+    dbmopen(%NS_Hist, "$ENV{HOME}/.netscape/history.db")
+       or die "Can't open netscape history file: $!";
+
 =item defined EXPR
 
 =item defined
@@ -842,7 +865,7 @@ defined values.  For example, if you say
 
 The pattern match succeeds, and C<$1> is defined, despite the fact that it
 matched "nothing".  But it didn't really match nothing--rather, it
-matched something that happened to be C<0> characters long.  This is all
+matched something that happened to be zero characters long.  This is all
 very above-board and honest.  When a function returns an undefined value,
 it's an admission that it couldn't give you an honest answer.  So you
 should use C<defined()> only when you're questioning the integrity of what
@@ -888,9 +911,14 @@ And so does this:
 
     delete @HASH{keys %HASH}
 
-(But both of these are slower than just assigning the empty list, or
-using C<undef()>.)  Note that the EXPR can be arbitrarily complicated as
-long as the final operation is a hash element lookup or hash slice:
+But both of these are slower than just assigning the empty list
+or undefining it:
+
+    %hash = ();                # completely empty %hash
+    undef %hash;       # forget %hash every existed
+
+Note that the EXPR can be arbitrarily complicated as long as the final
+operation is a hash element lookup or hash slice:
 
     delete $ref->[$x][$y]{$key};
     delete @{$ref->[$x][$y]}{$key1, $key2, @morekeys};
@@ -911,7 +939,12 @@ Equivalent examples:
 
 If the value of EXPR does not end in a newline, the current script line
 number and input line number (if any) are also printed, and a newline
-is supplied.  Hint: sometimes appending C<", stopped"> to your message
+is supplied.  Note that the "input line number" (also known as "chunk")
+is subject to whatever notion of "line" happens to be currently in
+effect, and is also available as the special variable C<$.>.
+See L<perlvar/"$/"> and L<perlvar/"$.">.
+
+Hint: sometimes appending C<", stopped"> to your message
 will cause it to make better sense when the string C<"at foo line 123"> is
 appended.  Suppose you are running script "canasta".
 
@@ -923,7 +956,7 @@ produce, respectively
     /etc/games is no good at canasta line 123.
     /etc/games is no good, stopped at canasta line 123.
 
-See also C<exit()> and C<warn()>.
+See also exit(), warn(), and the Carp module.
 
 If LIST is empty and C<$@> already contains a value (typically from a
 previous eval) that value is reused after appending C<"\t...propagated">.
@@ -934,30 +967,53 @@ This is useful for propagating exceptions:
 
 If C<$@> is empty then the string C<"Died"> is used.
 
+die() can also be called with a reference argument.  If this happens to be
+trapped within an eval(), $@ contains the reference.  This behavior permits
+a more elaborate exception handling implementation using objects that
+maintain arbitary state about the nature of the exception.  Such a scheme
+is sometimes preferable to matching particular string values of $@ using
+regular expressions.  Here's an example:
+
+    eval { ... ; die Some::Module::Exception->new( FOO => "bar" ) };
+    if ($@) {
+        if (ref($@) && UNIVERSAL::isa($@,"Some::Module::Exception")) {
+            # handle Some::Module::Exception
+        }
+        else {
+            # handle all other possible exceptions
+        }
+    }
+
+Since perl will stringify uncaught exception messages before displaying
+them, you may want to overload stringification operations on such custom
+exception objects.  See L<overload> for details about that.
+
 You can arrange for a callback to be run just before the C<die()> does
 its deed, by setting the C<$SIG{__DIE__}> hook.  The associated handler
 will be called with the error text and can change the error message, if
 it sees fit, by calling C<die()> again.  See L<perlvar/$SIG{expr}> for details on
 setting C<%SIG> entries, and L<"eval BLOCK"> for some examples.
 
-Note that the C<$SIG{__DIE__}> hook is called even inside eval()ed
-blocks/strings.  If one wants the hook to do nothing in such
+Note that the C<$SIG{__DIE__}> hook is currently called even inside
+eval()ed blocks/strings!  If one wants the hook to do nothing in such
 situations, put
 
        die @_ if $^S;
 
-as the first line of the handler (see L<perlvar/$^S>).
+as the first line of the handler (see L<perlvar/$^S>).  Because this
+promotes action at a distance, this counterintuitive behavior may be fixed
+in a future release.
 
 =item do BLOCK
 
 Not really a function.  Returns the value of the last command in the
 sequence of commands indicated by BLOCK.  When modified by a loop
-modifier such as L</while> or L</until>, executes the BLOCK once
-before testing the loop condition.  (On other statements the loop
-modifiers test the conditional first.)
+modifier, executes the BLOCK once before testing the loop condition.
+(On other statements the loop modifiers test the conditional first.)
 
 C<do BLOCK> does I<not> count as a loop, so the loop control statements
-L</next>, L</last> or L</redo> cannot be used to leave or restart the block.
+C<next>, C<last>, or C<redo> cannot be used to leave or restart the block.
+See L<perlsyn> for alternative strategies.
 
 =item do SUBROUTINE(LIST)
 
@@ -975,17 +1031,16 @@ is just like
 
     scalar eval `cat stat.pl`;
 
-except that it's more efficient and concise, keeps track of the
-current filename for error messages, and searches all the B<-I>
-libraries if the file isn't in the current directory (see also the @INC
-array in L<perlvar/Predefined Names>).  It is also different in how
-code evaluated with C<do FILENAME> doesn't see lexicals in the enclosing
-scope like C<eval STRING> does.  It's the same, however, in that it does
-reparse the file every time you call it, so you probably don't want to
-do this inside a loop.
+except that it's more efficient and concise, keeps track of the current
+filename for error messages, searches the @INC libraries, and updates
+C<%INC> if the file is found.  See L<perlvar/Predefined Names> for these
+variables.  It also differs in that code evaluated with C<do FILENAME>
+cannot see lexicals in the enclosing scope; C<eval STRING> does.  It's the
+same, however, in that it does reparse the file every time you call it,
+so you probably don't want to do this inside a loop.
 
 If C<do> cannot read the file, it returns undef and sets C<$!> to the
-error.    If C<do> can read the file but cannot compile it, it
+error.  If C<do> can read the file but cannot compile it, it
 returns undef and sets an error message in C<$@>.   If the file is
 successfully compiled, C<do> returns the value of the last expression
 evaluated.
@@ -999,7 +1054,8 @@ file.  Manual error checking can be done this way:
 
     # read in config files: system first, then user 
     for $file ("/share/prog/defaults.rc",
-               "$ENV{HOME}/.someprogrc") {
+               "$ENV{HOME}/.someprogrc") 
+   {
        unless ($return = do $file) {
            warn "couldn't parse $file: $@" if $@;
            warn "couldn't do $file: $!"    unless defined $return;
@@ -1009,6 +1065,8 @@ file.  Manual error checking can be done this way:
 
 =item dump LABEL
 
+=item dump
+
 This causes an immediate core dump.  Primarily this is so that you can
 use the B<undump> program to turn your core dump into an executable binary
 after having initialized all your variables at the beginning of the
@@ -1076,12 +1134,6 @@ only in a different order:
 
 See also C<keys()>, C<values()> and C<sort()>.
 
-=item else BLOCK
-
-=item elsif (EXPR) BLOCK
-
-See L</if>.
-
 =item eof FILEHANDLE
 
 =item eof ()
@@ -1097,11 +1149,11 @@ C<eof(FILEHANDLE)> on it) after end-of-file is reached.  Filetypes such
 as terminals may lose the end-of-file condition if you do.
 
 An C<eof> without an argument uses the last file read as argument.
-Using C<eof()> with empty parentheses is very different.  It indicates the pseudo file formed of
-the files listed on the command line, i.e., C<eof()> is reasonable to
-use inside a C<while (E<lt>E<gt>)> loop to detect the end of only the
-last file.  Use C<eof(ARGV)> or eof without the parentheses to test
-I<EACH> file in a while (E<lt>E<gt>) loop.  Examples:
+Using C<eof()> with empty parentheses is very different.  It indicates
+the pseudo file formed of the files listed on the command line, i.e.,
+C<eof()> is reasonable to use inside a C<while (E<lt>E<gt>)> loop to
+detect the end of only the last file.  Use C<eof(ARGV)> or eof without the
+parentheses to test I<EACH> file in a while (E<lt>E<gt>) loop.  Examples:
 
     # reset line numbering on each input file
     while (<>) {
@@ -1115,7 +1167,7 @@ I<EACH> file in a while (E<lt>E<gt>) loop.  Examples:
     while (<>) {
        if (eof()) {            # check for end of current file
            print "--------------\n";
-           close(ARGV);        # close or break; is needed if we
+           close(ARGV);        # close or last; is needed if we
                                # are reading from the terminal
        }
        print;
@@ -1184,10 +1236,11 @@ Examples:
     # a run-time error
     eval '$answer =';  # sets $@
 
-When using the C<eval{}> form as an exception trap in libraries, you may
-wish not to trigger any C<__DIE__> hooks that user code may have
-installed.  You can use the C<local $SIG{__DIE__}> construct for this
-purpose, as shown in this example:
+Due to the current arguably broken state of C<__DIE__> hooks, when using
+the C<eval{}> form as an exception trap in libraries, you may wish not
+to trigger any C<__DIE__> hooks that user code may have installed.
+You can use the C<local $SIG{__DIE__}> construct for this purpose,
+as shown in this example:
 
     # a very private exception trap for divide-by-zero
     eval { local $SIG{'__DIE__'}; $answer = $a / $b; };
@@ -1204,6 +1257,9 @@ C<die()> again, which has the effect of changing their error messages:
        print $@ if $@;                # prints "bar lives here"
     }
 
+Because this promotes action at a distance, this counterintuive behavior
+may be fixed in a future release.
+
 With an C<eval()>, you should be especially careful to remember what's
 being looked at when:
 
@@ -1228,8 +1284,7 @@ particular situation, you can just use symbolic references instead, as
 in case 6.
 
 C<eval BLOCK> does I<not> count as a loop, so the loop control statements
-C<next>, C<last> or C<redo> cannot be used to leave or restart the block.
-
+C<next>, C<last>, or C<redo> cannot be used to leave or restart the block.
 
 =item exec LIST
 
@@ -1288,9 +1343,9 @@ shell expanding wildcards or splitting up words with whitespace in them.
 
     @args = ( "echo surprise" );
 
-    system @args;               # subject to shell escapes
+    exec @args;               # subject to shell escapes
                                 # if @args == 1
-    system { $args[0] } @args;  # safe even with one-arg list
+    exec { $args[0] } @args;  # safe even with one-arg list
 
 The first version, the one without the indirect object, ran the I<echo>
 program, passing it C<"surprise"> an argument.  The second version
@@ -1305,9 +1360,9 @@ any C<DESTROY> methods in your objects.
 Returns TRUE if the specified hash key exists in its hash array, even
 if the corresponding value is undefined.
 
-    print "Exists\n" if exists $array{$key};
-    print "Defined\n" if defined $array{$key};
-    print "True\n" if $array{$key};
+    print "Exists\n"   if exists $array{$key};
+    print "Defined\n"  if defined $array{$key};
+    print "True\n"      if $array{$key};
 
 A hash element can be TRUE only if it's defined, and defined if
 it exists, but the reverse doesn't necessarily hold true.
@@ -1315,40 +1370,53 @@ it exists, but the reverse doesn't necessarily hold true.
 Note that the EXPR can be arbitrarily complicated as long as the final
 operation is a hash key lookup:
 
-    if (exists $ref->{"A"}{"B"}{$key}) { ... }
+    if (exists $ref->{A}->{B}->{$key})         { }
+    if (exists $hash{A}{B}{$key})      { }
+
+Although the last element will not spring into existence just because
+its existence was tested, intervening ones will.  Thus C<$ref-E<gt>{"A"}>
+and C<$ref-E<gt>{"A"}-E<gt>{"B"}> will spring into existence due to the
+existence test for a $key element.  This happens anywhere the arrow
+operator is used, including even 
 
-Although the last element will not spring into existence just because its
-existence was tested, intervening ones will.  Thus C<$ref-E<gt>{"A"}>
-C<$ref-E<gt>{"B"}> will spring into existence due to the existence
-test for a $key element.  This autovivification may be fixed in a later
+    undef $ref;
+    if (exists $ref->{"Some key"})     { }
+    print $ref;            # prints HASH(0x80d3d5c)
+
+This surprising autovivification in what does not at first--or even
+second--glance appear to be an lvalue context may be fixed in a future
 release.
 
 =item exit EXPR
 
-Evaluates EXPR and exits immediately with that value.  (Actually, it
-calls any defined C<END> routines first, but the C<END> routines may not
-abort the exit.  Likewise any object destructors that need to be called
-are called before exit.)  Example:
+Evaluates EXPR and exits immediately with that value.    Example:
 
     $ans = <STDIN>;
     exit 0 if $ans =~ /^[Xx]/;
 
 See also C<die()>.  If EXPR is omitted, exits with C<0> status.  The only
-universally portable values for EXPR are C<0> for success and C<1> for error;
-all other values are subject to unpredictable interpretation depending
-on the environment in which the Perl program is running.
+universally recognized values for EXPR are C<0> for success and C<1>
+for error; other values are subject to interpretation depending on the
+environment in which the Perl program is running.  For example, exiting
+69 (EX_UNAVAILABLE) from a I<sendmail> incoming-mail filter will cause
+the mailer to return the item undelivered, but that's not true everywhere.
 
-You shouldn't use C<exit()> to abort a subroutine if there's any chance that
+Don't use C<exit()> to abort a subroutine if there's any chance that
 someone might want to trap whatever error happened.  Use C<die()> instead,
 which can be trapped by an C<eval()>.
 
-All C<END{}> blocks are run at exit time.  See L<perlsub> for details.
+The exit() function does not always exit immediately. It calls any
+defined C<END> routines first, but these C<END> routines may not
+themselves abort the exit. Likewise any object destructors that need to
+be called are called before the real exit.  If this is a problem, you
+can call C<POSIX:_exit($status)> to avoid END and destructor processing.
+See L<perlsub> for details.
 
 =item exp EXPR
 
 =item exp
 
-Returns I<e> (the natural logarithm base) to the power of EXPR.
+Returns I<e> (the natural logarithm base) to the power of EXPR.  
 If EXPR is omitted, gives C<exp($_)>.
 
 =item fcntl FILEHANDLE,FUNCTION,SCALAR
@@ -1365,22 +1433,23 @@ For example:
     fcntl($filehandle, F_GETFL, $packed_return_buffer)
        or die "can't fcntl F_GETFL: $!";
 
-You don't have to check for C<defined()> on the return from 
-C<fnctl()>.  Like C<ioctl()>, it maps a C<0> return from the system
-call into "C<0> but true" in Perl.  This string is true in 
-boolean context and C<0> in numeric context.  It is also 
-exempt from the normal B<-w> warnings on improper numeric
-conversions.
+You don't have to check for C<defined()> on the return from C<fnctl()>.
+Like C<ioctl()>, it maps a C<0> return from the system call into "C<0>
+but true" in Perl.  This string is true in boolean context and C<0>
+in numeric context.  It is also exempt from the normal B<-w> warnings
+on improper numeric conversions.
 
 Note that C<fcntl()> will produce a fatal error if used on a machine that
-doesn't implement fcntl(2).
+doesn't implement fcntl(2).  See the Fcntl module or your fcntl(2)
+manpage to learn what functions are available on your system.
 
 =item fileno FILEHANDLE
 
-Returns the file descriptor for a filehandle.  This is useful for
-constructing bitmaps for C<select()> and low-level POSIX tty-handling
-operations.  If FILEHANDLE is an expression, the value is taken as 
-an indirect filehandle, generally its name. 
+Returns the file descriptor for a filehandle, or undefined if the
+filehandle is not open.  This is mainly useful for constructing
+bitmaps for C<select()> and low-level POSIX tty-handling operations.
+If FILEHANDLE is an expression, the value is taken as an indirect
+filehandle, generally its name.
 
 You can use this to find out whether two handles refer to the 
 same underlying descriptor:
@@ -1391,18 +1460,23 @@ same underlying descriptor:
 
 =item flock FILEHANDLE,OPERATION
 
-Calls flock(2), or an emulation of it, on FILEHANDLE.  Returns TRUE for
-success, FALSE on failure.  Produces a fatal error if used on a machine
-that doesn't implement flock(2), fcntl(2) locking, or lockf(3).  C<flock()>
-is Perl's portable file locking interface, although it locks only entire
-files, not records.
-
-On many platforms (including most versions or clones of Unix), locks
-established by C<flock()> are B<merely advisory>.  Such discretionary locks
-are more flexible, but offer fewer guarantees.  This means that files
-locked with C<flock()> may be modified by programs that do not also use
-C<flock()>.  Windows NT and OS/2 are among the platforms which
-enforce mandatory locking.  See your local documentation for details.
+Calls flock(2), or an emulation of it, on FILEHANDLE.  Returns TRUE
+for success, FALSE on failure.  Produces a fatal error if used on a
+machine that doesn't implement flock(2), fcntl(2) locking, or lockf(3).
+C<flock()> is Perl's portable file locking interface, although it locks
+only entire files, not records.
+
+Two potentially non-obvious but traditional C<flock> semantics are
+that it waits indefinitely until the lock is granted, and that its locks
+B<merely advisory>.  Such discretionary locks are more flexible, but offer
+fewer guarantees.  This means that files locked with C<flock()> may be
+modified by programs that do not also use C<flock()>.  See L<perlport>,
+your port's specific documentation, or your system-specific local manpages
+for details.  It's best to assume traditional behavior if you're writing
+portable programs.  (But if you're not, you should as always feel perfectly
+free to write for your own system's idiosyncrasies (sometimes called
+"features").  Slavish adherence to portability concerns shouldn't get
+in the way of your getting your job done.)
 
 OPERATION is one of LOCK_SH, LOCK_EX, or LOCK_UN, possibly combined with
 LOCK_NB.  These constants are traditionally valued 1, 2, 8 and 4, but
@@ -1413,12 +1487,12 @@ releases a previously requested lock.  If LOCK_NB is added to LOCK_SH or
 LOCK_EX then C<flock()> will return immediately rather than blocking
 waiting for the lock (check the return status to see if you got it).
 
-To avoid the possibility of mis-coordination, Perl flushes FILEHANDLE
-before (un)locking it.
+To avoid the possibility of miscoordination, Perl now flushes FILEHANDLE
+before locking or unlocking it.
 
 Note that the emulation built with lockf(3) doesn't provide shared
 locks, and it requires that FILEHANDLE be open with write intent.  These
-are the semantics that lockf(3) implements.  Most (all?) systems
+are the semantics that lockf(3) implements.  Most if not all systems
 implement lockf(3) in terms of fcntl(2) locking, though, so the
 differing semantics shouldn't bite too many people.
 
@@ -1451,76 +1525,37 @@ Here's a mailbox appender for BSD systems.
     print MBOX $msg,"\n\n";
     unlock();
 
-See also L<DB_File> for other flock() examples.
-
-=item for (INITIAL; WHILE; EACH) BLOCK
-
-Do INITIAL, enter BLOCK while EXPR is true, at the end of each round
-do EACH. For example:
-
-       for ($i = 0, $j = 0; $i < 10; $i++) {
-               if ($i % 3 == 0) { $j++ }
-               print "i = $i, j = $j\n";
-       }
-
-See L<perlsyn> for more details.  See also L</foreach>, a twin of
-C<for>, L</while> and L</until>, close cousins of L<for>, and
-L</last>, L</next>, and L</redo> for additional control flow.
-
-=item foreach LOOPVAR (LIST) BLOCK
-
-Enter BLOCK as LOOPVAR set in turn to each element of LIST.
-For example:
-
-       foreach $rolling (@stones) { print "rolling $stone\n" }
-
-       foreach my $file (@files)  { print "file $file\n" }
-
-The LOOPVAR is optional and defaults to C<$_>.  If the elements are
-modifiable (as opposed to constants or tied variables) you can modify them.
-
-       foreach (@words) { tr/abc/xyz/ }
+On systems that support a real flock(), locks are inherited across fork()
+calls, whereas those that must resort to the more capricious fcntl()
+function lose the locks, making it harder to write servers.
 
-See L<perlsyn> for more details.  See also L</for>, a twin of
-C<foreach>, L</while> and L</until>, close cousins of L<for>, and
-L</last>, L</next>, and L</redo> for additional control flow.
+See also L<DB_File> for other flock() examples.
 
 =item fork
 
-Does a fork(2) system call.  Returns the child pid to the parent process,
-C<0> to the child process, or C<undef> if the fork is unsuccessful.
+Does a fork(2) system call to create a new process running the
+same program at the same point.  It returns the child pid to the
+parent process, C<0> to the child process, or C<undef> if the fork is
+unsuccessful.  File descriptors (and sometimes locks on those descriptors)
+are shared, while everything else is copied.  On most systems supporting
+fork(), great care has gone into making it extremely efficient (for
+example, using copy-on-write technology on data pages), making it the
+dominant paradigm for multitasking over the last few decades.
 
 Note: unflushed buffers remain unflushed in both processes, which means
 you may need to set C<$|> ($AUTOFLUSH in English) or call the C<autoflush()>
 method of C<IO::Handle> to avoid duplicate output.
 
-If you C<fork()> without ever waiting on your children, you will accumulate
-zombies:
-
-    $SIG{CHLD} = sub { wait };
-
-There's also the double-fork trick (error checking on
-C<fork()> returns omitted);
-
-    unless ($pid = fork) {
-       unless (fork) {
-           exec "what you really wanna do";
-           die "no exec";
-           # ... or ...
-           ## (some_perl_code_here)
-           exit 0;
-       }
-       exit 0;
-    }
-    waitpid($pid,0);
-
-See also L<perlipc> for more examples of forking and reaping
-moribund children.
+If you C<fork()> without ever waiting on your children, you will
+accumulate zombies.  On some systems, you can avoid this by setting
+C<$SIG{CHLD}> to C<"IGNORE">.  See also L<perlipc> for more examples of
+forking and reaping moribund children.
 
 Note that if your forked child inherits system file descriptors like
 STDIN and STDOUT that are actually connected by a pipe or socket, even
-if you exit, then the remote server (such as, say, httpd or rsh) won't think
-you're done.  You should reopen those to F</dev/null> if it's any issue.
+if you exit, then the remote server (such as, say, a CGI script or a
+backgrounded job launced from a remote shell) won't think you're done.
+You should reopen those to F</dev/null> if it's any issue.
 
 =item format
 
@@ -1563,10 +1598,11 @@ C<formline()> always returns TRUE.  See L<perlform> for other examples.
 =item getc
 
 Returns the next character from the input file attached to FILEHANDLE,
-or the undefined value at end of file, or if there was an error.  If
-FILEHANDLE is omitted, reads from STDIN.  This is not particularly
-efficient.  It cannot be used to get unbuffered single-characters,
-however.  For that, try something more like:
+or the undefined value at end of file, or if there was an error.
+If FILEHANDLE is omitted, reads from STDIN.  This is not particularly
+efficient.  However, it cannot be used by itself to fetch single
+characters without waiting for the user to hit enter.  For that, try
+something more like:
 
     if ($BSD_STYLE) {
        system "stty cbreak </dev/tty >/dev/tty 2>&1";
@@ -1588,10 +1624,10 @@ however.  For that, try something more like:
 Determination of whether $BSD_STYLE should be set
 is left as an exercise to the reader.
 
-The C<POSIX::getattr()> function can do this more portably on systems
-purporting POSIX compliance.
-See also the C<Term::ReadKey> module from your nearest CPAN site;
-details on CPAN can be found on L<perlmod/CPAN>.
+The C<POSIX::getattr()> function can do this more portably on
+systems purporting POSIX compliance.  See also the C<Term::ReadKey>
+module from your nearest CPAN site; details on CPAN can be found on
+L<perlmodlib/CPAN>.
 
 =item getlogin
 
@@ -1719,21 +1755,26 @@ lookup by name, in which case you get the other thing, whatever it is.
     $name  = getgrent();
     #etc.
 
-In I<getpw*()> the fields C<$quota>, C<$comment>, and C<$expire> are special
-cases in the sense that in many systems they are unsupported.  If the
-C<$quota> is unsupported, it is an empty scalar.  If it is supported, it
-usually encodes the disk quota.  If the C<$comment> field is unsupported,
-it is an empty scalar.  If it is supported it usually encodes some
-administrative comment about the user.  In some systems the $quota
-field may be C<$change> or C<$age>, fields that have to do with password
-aging.  In some systems the C<$comment> field may be C<$class>.  The C<$expire>
-field, if present, encodes the expiration period of the account or the
-password.  For the availability and the exact meaning of these fields
-in your system, please consult your getpwnam(3) documentation and your
-F<pwd.h> file.  You can also find out from within Perl which meaning
-your C<$quota> and C<$comment> fields have and whether you have the C<$expire>
-field by using the C<Config> module and the values C<d_pwquota>, C<d_pwage>,
-C<d_pwchange>, C<d_pwcomment>, and C<d_pwexpire>.
+In I<getpw*()> the fields C<$quota>, C<$comment>, and C<$expire> are
+special cases in the sense that in many systems they are unsupported.
+If the C<$quota> is unsupported, it is an empty scalar.  If it is
+supported, it usually encodes the disk quota.  If the C<$comment>
+field is unsupported, it is an empty scalar.  If it is supported it
+usually encodes some administrative comment about the user.  In some
+systems the $quota field may be C<$change> or C<$age>, fields that have
+to do with password aging.  In some systems the C<$comment> field may
+be C<$class>.  The C<$expire> field, if present, encodes the expiration
+period of the account or the password.  For the availability and the
+exact meaning of these fields in your system, please consult your
+getpwnam(3) documentation and your F<pwd.h> file.  You can also find
+out from within Perl what your C<$quota> and C<$comment> fields mean
+and whether you have the C<$expire> field by using the C<Config> module
+and the values C<d_pwquota>, C<d_pwage>, C<d_pwchange>, C<d_pwcomment>,
+and C<d_pwexpire>.  Shadow password files are only supported if your
+vendor has implemented them in the intuitive fashion that calling the
+regular C library routines gets the shadow versions if you're running
+under privilege.  Those that incorrectly implement a separate library
+call are not supported.
 
 The C<$members> value returned by I<getgr*()> is a space separated list of
 the login names of the members of the group.
@@ -1747,6 +1788,15 @@ by saying something like:
 
     ($a,$b,$c,$d) = unpack('C4',$addr[0]);
 
+The Socket library makes this slightly easier:
+
+    use Socket;
+    $iaddr = inet_aton("127.1"); # or whatever address
+    $name  = gethostbyaddr($iaddr, AF_INET);
+
+    # or going the other way
+    $straddr = inet_ntoa($iaddr");
+
 If you get tired of remembering which element of the return list contains
 which return value, by-name interfaces are also provided in modules:
 C<File::stat>, C<Net::hostent>, C<Net::netent>, C<Net::protoent>, C<Net::servent>,
@@ -1777,11 +1827,11 @@ Returns the socket option requested, or undef if there is an error.
 
 =item glob
 
-Returns the value of EXPR with filename expansions such as the standard Unix shell F</bin/sh> would
-do.  This is the internal function implementing the C<E<lt>*.cE<gt>>
-operator, but you can use it directly.  If EXPR is omitted, C<$_> is used.
-The C<E<lt>*.cE<gt>> operator is discussed in more detail in
-L<perlop/"I/O Operators">.
+Returns the value of EXPR with filename expansions such as the
+standard Unix shell F</bin/csh> would do.  This is the internal function
+implementing the C<E<lt>*.cE<gt>> operator, but you can use it directly.
+If EXPR is omitted, C<$_> is used.  The C<E<lt>*.cE<gt>> operator is
+discussed in more detail in L<perlop/"I/O Operators">.
 
 =item gmtime EXPR
 
@@ -1794,9 +1844,12 @@ Typically used as follows:
                                            gmtime(time);
 
 All array elements are numeric, and come straight out of a struct tm.
-In particular this means that C<$mon> has the range C<0..11> and C<$wday> has
-the range C<0..6> with sunday as day C<0>.  Also, C<$year> is the number of
-years since 1900, that is, C<$year> is C<123> in year 2023, I<not> simply the last two digits of the year.
+In particular this means that C<$mon> has the range C<0..11> and C<$wday>
+has the range C<0..6> with sunday as day C<0>.  Also, C<$year> is the
+number of years since 1900, that is, C<$year> is C<123> in year 2023,
+I<not> simply the last two digits of the year.  If you assume it is,
+then you create non-Y2K-compliant programs--and you wouldn't want to do
+that, would you?
 
 If EXPR is omitted, does C<gmtime(time())>.
 
@@ -1807,18 +1860,19 @@ In scalar context, returns the ctime(3) value:
 Also see the C<timegm()> function provided by the C<Time::Local> module,
 and the strftime(3) function available via the POSIX module.
 
-This scalar value is B<not> locale dependent, see L<perllocale>, but
-instead a Perl builtin.  Also see the C<Time::Local> module, and the
-strftime(3) and mktime(3) function available via the POSIX module.  To
+This scalar value is B<not> locale dependent (see L<perllocale>), but
+is instead a Perl builtin.  Also see the C<Time::Local> module, and the
+strftime(3) and mktime(3) functions available via the POSIX module.  To
 get somewhat similar but locale dependent date strings, set up your
 locale environment variables appropriately (please see L<perllocale>)
 and try for example:
 
     use POSIX qw(strftime);
-       $now_string = strftime "%a %b %e %H:%M:%S %Y", gmtime;
+    $now_string = strftime "%a %b %e %H:%M:%S %Y", gmtime;
 
-Note that the C<%a> and C<%b>, the short forms of the day of the week
-and the month of the year, may not necessarily be three characters wide.
+Note that the C<%a> and C<%b> escapes, which represent the short forms
+of the day of the week and the month of the year, may not necessarily
+be three characters wide in all locales.
 
 =item goto LABEL
 
@@ -1854,13 +1908,12 @@ will be able to tell that this routine was called first.
 
 =item grep EXPR,LIST
 
-This is similar in spirit to, but not the same as, grep(1)
-and its relatives.  In particular, it is not limited to using
-regular expressions.
+This is similar in spirit to, but not the same as, grep(1) and its
+relatives.  In particular, it is not limited to using regular expressions.
 
 Evaluates the BLOCK or EXPR for each element of LIST (locally setting
 C<$_> to each element) and returns the list value consisting of those
-elements for which the expression evaluated to TRUE.  In a scalar
+elements for which the expression evaluated to TRUE.  In scalar
 context, returns the number of times the expression was TRUE.
 
     @foo = grep(!/^#/, @bar);    # weed out comments
@@ -1869,14 +1922,14 @@ or equivalently,
 
     @foo = grep {!/^#/} @bar;    # weed out comments
 
-Note that, because C<$_> is a reference into the list value, it can be used
-to modify the elements of the array.  While this is useful and
-supported, it can cause bizarre results if the LIST is not a named
-array.  Similarly, grep returns aliases into the original list,
-much like the way that a for loop's index variable aliases the list
-elements.  That is, modifying an element of a list returned by grep
-(for example, in a C<foreach>, C<map()> or another C<grep()>)
-actually modifies the element in the original list.
+Note that, because C<$_> is a reference into the list value, it can
+be used to modify the elements of the array.  While this is useful and
+supported, it can cause bizarre results if the LIST is not a named array.
+Similarly, grep returns aliases into the original list, much as a for
+loop's index variable aliases the list elements.  That is, modifying an
+element of a list returned by grep (for example, in a C<foreach>, C<map()>
+or another C<grep()>) actually modifies the element in the original list.
+This is usually something to be avoided when writing clear code.
 
 See also L</map> for an array composed of the results of the BLOCK or EXPR.
 
@@ -1884,28 +1937,13 @@ See also L</map> for an array composed of the results of the BLOCK or EXPR.
 
 =item hex
 
-Interprets EXPR as a hex string and returns the corresponding
-value.  (To convert strings that might start with either 0 or 0x
-see L</oct>.)  If EXPR is omitted, uses C<$_>.
+Interprets EXPR as a hex string and returns the corresponding value.
+(To convert strings that might start with either 0, 0x, or 0b, see
+L</oct>.)  If EXPR is omitted, uses C<$_>.
 
     print hex '0xAf'; # prints '175'
     print hex 'aF';   # same
 
-=item if (EXPR) BLOCK
-
-=item if (EXPR) BLOCK else BLOCK2
-
-=item if (EXPR) BLOCK elsif (EXPR2) BLOCK2
-
-Enter BLOCKs conditionally.  The first EXPR to return true
-causes the corresponding BLOCK to be entered, or, in the case
-of C<else>, the fall-through default BLOCK.
-
-Take notice: Perl wants BLOCKS, expressions (like e.g. in C, C++, or
-Pascal) won't do.
-
-See L<perlsyn> for more details.  See also C<unless>.
-
 =item import
 
 There is no builtin C<import()> function.  It is just an ordinary
@@ -1917,29 +1955,34 @@ for the package used.  See also L</use()>, L<perlmod>, and L<Exporter>.
 
 =item index STR,SUBSTR
 
-Returns the position of the first occurrence of SUBSTR in STR at or after
-POSITION.  If POSITION is omitted, starts searching from the beginning of
-the string.  The return value is based at C<0> (or whatever you've set the C<$[>
-variable to--but don't do that).  If the substring is not found, returns
-one less than the base, ordinarily C<-1>.
+The index function searches for one string within another, but without
+the wildcard-like behavior of a full regular-expression pattern match.
+It returns the position of the first occurrence of SUBSTR in STR at
+or after POSITION.  If POSITION is omitted, starts searching from the
+beginning of the string.  The return value is based at C<0> (or whatever
+you've set the C<$[> variable to--but don't do that).  If the substring
+is not found, returns one less than the base, ordinarily C<-1>.
 
 =item int EXPR
 
 =item int
 
 Returns the integer portion of EXPR.  If EXPR is omitted, uses C<$_>.
-You should not use this for rounding, because it truncates
-towards C<0>, and because machine representations of floating point
-numbers can sometimes produce counterintuitive results.  Usually C<sprintf()> or C<printf()>,
-or the C<POSIX::floor> or C<POSIX::ceil> functions, would serve you better.
+You should not use this function for rounding: one because it truncates
+towards C<0>, and two because machine representations of floating point
+numbers can sometimes produce counterintuitive results.  For example,
+C<int(-6.725/0.025)> produces -268 rather than the correct -269; that's
+because it's really more like -268.99999999999994315658 instead.  Usually,
+the C<sprintf()>, C<printf()>, or the C<POSIX::floor> and C<POSIX::ceil>
+functions will serve you better than will int().
 
 =item ioctl FILEHANDLE,FUNCTION,SCALAR
 
-Implements the ioctl(2) function.  You'll probably have to say
+Implements the ioctl(2) function.  You'll probably first have to say
 
     require "ioctl.ph";        # probably in /usr/local/lib/perl/ioctl.ph
 
-first to get the correct function definitions.  If F<ioctl.ph> doesn't
+to get the correct function definitions.  If F<ioctl.ph> doesn't
 exist or doesn't have the correct definitions you'll have to roll your
 own, based on your C header files such as F<E<lt>sys/ioctl.hE<gt>>.
 (There is a Perl script called B<h2ph> that comes with the Perl kit that
@@ -1975,19 +2018,18 @@ Thus Perl returns TRUE on success and FALSE on failure, yet you can
 still easily determine the actual value returned by the operating
 system:
 
-    ($retval = ioctl(...)) || ($retval = -1);
+    $retval = ioctl(...) || -1;
     printf "System returned %d\n", $retval;
 
-The special string "C<0> but true" is excempt from B<-w> complaints
+The special string "C<0> but true" is exempt from B<-w> complaints
 about improper numeric conversions.
 
 =item join EXPR,LIST
 
-Joins the separate strings of LIST into a single string with
-fields separated by the value of EXPR, and returns the string.
-Example:
+Joins the separate strings of LIST into a single string with fields
+separated by the value of EXPR, and returns that new string.  Example:
 
-    $_ = join(':', $login,$passwd,$uid,$gid,$gcos,$home,$shell);
+    $rec = join(':', $login,$passwd,$uid,$gid,$gcos,$home,$shell);
 
 See L</split>.
 
@@ -2069,12 +2111,11 @@ C<continue> block, if any, is not executed:
     }
 
 C<last> cannot be used to exit a block which returns a value such as
-C<eval {}>, C<sub {}> or C<do {}>.
-
-See also L</continue> for an illustration of how C<last>, L</next>, and
-L</redo> work.
+C<eval {}>, C<sub {}> or C<do {}>, and should not be used to exit
+a grep() or map() operation.
 
-See also L<perlsyn>.
+See also L</continue> for an illustration of how C<last>, C<next>, and
+C<redo> work.
 
 =item lc EXPR
 
@@ -2101,29 +2142,31 @@ If EXPR is omitted, uses C<$_>.
 =item length
 
 Returns the length in characters of the value of EXPR.  If EXPR is
-omitted, returns length of C<$_>.
+omitted, returns length of C<$_>.  Note that this cannot be used on 
+an entire array or hash to find out how many elements these have.
+For that, use C<scalar @array> and C<scalar keys %hash> respectively.
 
 =item link OLDFILE,NEWFILE
 
 Creates a new filename linked to the old filename.  Returns TRUE for
-success, FALSE otherwise.
+success, FALSE otherwise. 
 
 =item listen SOCKET,QUEUESIZE
 
 Does the same thing that the listen system call does.  Returns TRUE if
-it succeeded, FALSE otherwise.  See example in L<perlipc/"Sockets: Client/Server Communication">.
+it succeeded, FALSE otherwise.  See the example in L<perlipc/"Sockets: Client/Server Communication">.
 
 =item local EXPR
 
+You really probably want to be using C<my()> instead, because C<local()> isn't
+what most people think of as "local".  See L<perlsub/"Private Variables
+via my()"> for details.
+
 A local modifies the listed variables to be local to the enclosing
 block, file, or eval.  If more than one value is listed, the list must
 be placed in parentheses.  See L<perlsub/"Temporary Values via local()">
 for details, including issues with tied arrays and hashes.
 
-You really probably want to be using C<my()> instead, because C<local()> isn't
-what most people think of as "local".  See L<perlsub/"Private Variables
-via my()"> for details.
-
 =item localtime EXPR
 
 Converts a time as returned by the time function to a 9-element array
@@ -2135,9 +2178,12 @@ follows:
                                                localtime(time);
 
 All array elements are numeric, and come straight out of a struct tm.
-In particular this means that C<$mon> has the range C<0..11> and C<$wday> has
-the range C<0..6> with sunday as day C<0>.  Also, C<$year> is the number of
-years since 1900, that is, C<$year> is C<123> in year 2023, and I<not> simply the last two digits of the year.
+In particular this means that C<$mon> has the range C<0..11> and C<$wday>
+has the range C<0..6> with sunday as day C<0>.  Also, C<$year> is the
+number of years since 1900, that is, C<$year> is C<123> in year 2023,
+and I<not> simply the last two digits of the year.  If you assume it is,
+then you create non-Y2K-compliant programs--and you wouldn't want to do
+that, would you?
 
 If EXPR is omitted, uses the current time (C<localtime(time)>).
 
@@ -2153,7 +2199,7 @@ locale environment variables appropriately (please see L<perllocale>)
 and try for example:
 
     use POSIX qw(strftime);
-       $now_string = strftime "%a %b %e %H:%M:%S %Y", localtime;
+    $now_string = strftime "%a %b %e %H:%M:%S %Y", localtime;
 
 Note that the C<%a> and C<%b>, the short forms of the day of the week
 and the month of the year, may not necessarily be three characters wide.
@@ -2162,8 +2208,17 @@ and the month of the year, may not necessarily be three characters wide.
 
 =item log
 
-Returns the natural logarithm (base I<e>) of EXPR.  If EXPR is omitted, returns log
-of C<$_>.
+Returns the natural logarithm (base I<e>) of EXPR.  If EXPR is omitted,
+returns log of C<$_>.  To get the log of another base, use basic algebra:
+The base-N log of a number is is equal to the natural log of that number
+divided by the natural log of N.  For example:
+
+    sub log10 {
+       my $n = shift;
+       return log($n)/log(10);
+    } 
+
+See also L</exp> for the inverse operation.
 
 =item lstat FILEHANDLE
 
@@ -2191,6 +2246,8 @@ element) and returns the list value composed of the results of each such
 evaluation.  Evaluates BLOCK or EXPR in a list context, so each element of LIST
 may produce zero, one, or more elements in the returned value.
 
+In scalar context, returns the total number of elements so generated.
+
     @chars = map(chr, @nums);
 
 translates a list of numbers to the corresponding characters.  And
@@ -2204,11 +2261,12 @@ is just a funny way to write
        $hash{getkey($_)} = $_;
     }
 
-Note that, because C<$_> is a reference into the list value, it can be used
-to modify the elements of the array.  While this is useful and
-supported, it can cause bizarre results if the LIST is not a named
-array.  See also L</grep> for an array composed of those items of the 
-original list for which the BLOCK or EXPR evaluates to true.
+Note that, because C<$_> is a reference into the list value, it can
+be used to modify the elements of the array.  While this is useful and
+supported, it can cause bizarre results if the LIST is not a named array.
+Using a regular C<foreach> loop for this purpose would be clearer in
+most cases.  See also L</grep> for an array composed of those items of
+the original list for which the BLOCK or EXPR evaluates to true.
 
 =item mkdir FILENAME,MODE
 
@@ -2282,12 +2340,11 @@ executed even on discarded lines.  If the LABEL is omitted, the command
 refers to the innermost enclosing loop.
 
 C<next> cannot be used to exit a block which returns a value such as
-C<eval {}>, C<sub {}> or C<do {}>.
+C<eval {}>, C<sub {}> or C<do {}>, and should not be used to exit
+a grep() or map() operation.
 
-See also L</continue> for an illustration of how L</last>, C<next>, and
-L</redo> work.
-
-See also L<perlsyn>.
+See also L</continue> for an illustration of how C<last>, C<next>, and
+C<redo> work.
 
 =item no Module LIST
 
@@ -2298,8 +2355,9 @@ See the L</use> function, which C<no> is the opposite of.
 =item oct
 
 Interprets EXPR as an octal string and returns the corresponding
-value.  (If EXPR happens to start off with C<0x>, interprets it as
-a hex string instead.)  The following will handle decimal, octal, and
+value.  (If EXPR happens to start off with C<0x>, interprets it as a
+hex string.  If EXPR starts off with C<0b>, it is interpreted as a
+binary string.)  The following will handle decimal, binary, octal, and
 hex in the standard Perl or C notation:
 
     $val = oct($val) if $val =~ /^0/;
@@ -2319,7 +2377,8 @@ name of the real filehandle wanted.  If EXPR is omitted, the scalar
 variable of the same name as the FILEHANDLE contains the filename.
 (Note that lexical variables--those declared with C<my()>--will not work
 for this purpose; so if you're using C<my()>, specify EXPR in your call
-to open.)
+to open.)  See L<perlopentut> for a kinder, gentler explanation of opening
+files.
 
 If the filename begins with C<'E<lt>'> or nothing, the file is opened for input.
 If the filename begins with C<'E<gt>'>, the file is truncated and opened for
@@ -2339,7 +2398,8 @@ C<'w+'>, C<'a'>, and C<'a+'>.
 
 If the filename begins with C<'|'>, the filename is interpreted as a
 command to which output is to be piped, and if the filename ends with a
-C<'|'>, the filename is interpreted See L<perlipc/"Using open() for IPC">
+C<'|'>, the filename is interpreted as a command which pipes output to
+us.  See L<perlipc/"Using open() for IPC">
 for more examples of this.  (You are not allowed to C<open()> to a command
 that pipes both in I<and> out, but see L<IPC::Open2>, L<IPC::Open3>,
 and L<perlipc/"Bidirectional Communication"> for alternatives.)
@@ -2440,7 +2500,6 @@ STDERR:
     print STDOUT "stdout 2\n";
     print STDERR "stderr 2\n";
 
-
 If you specify C<'E<lt>&=N'>, where C<N> is a number, then Perl will do an
 equivalent of C's C<fdopen()> of that file descriptor; this is more
 parsimonious of file descriptors.  For example:
@@ -2522,7 +2581,7 @@ them, and automatically close whenever and however you leave that scope:
        $first;                                 # Or here.
     }
 
-See L</seek()> for some details about mixing reading and writing.
+See L</seek> for some details about mixing reading and writing.
 
 =item opendir DIRHANDLE,EXPR
 
@@ -2536,6 +2595,7 @@ DIRHANDLEs have their own namespace separate from FILEHANDLEs.
 
 Returns the numeric (ASCII or Unicode) value of the first character of EXPR.  If
 EXPR is omitted, uses C<$_>.  For the reverse, see L</chr>.
+See L<utf8> for more about Unicode.
 
 =item pack TEMPLATE,LIST
 
@@ -2544,8 +2604,10 @@ returning the string containing the structure.  The TEMPLATE is a
 sequence of characters that give the order and type of values, as
 follows:
 
+    a  A string with arbitrary binary data, will be null padded.
     A  An ascii string, will be space padded.
-    a  An ascii string, will be null padded.
+    Z  A null terminated (asciz) string, will be null padded.
+
     b  A bit string (ascending bit order, like vec()).
     B  A bit string (descending bit order).
     h  A hex string (low nybble first).
@@ -2561,7 +2623,7 @@ follows:
 
     i  A signed integer value.
     I  An unsigned integer value.
-         (This 'integer' is _at_least_ 32 bits wide.  Its exact
+         (This 'integer' is _at least_ 32 bits wide.  Its exact
            size depends on what a local C compiler calls 'int',
            and may even be larger than the 'long' described in
            the next item.)
@@ -2603,30 +2665,124 @@ follows:
     X  Back up a byte.
     @  Null fill to absolute position.
 
+The following rules apply:
+
+=over 8
+
+=item *
+
 Each letter may optionally be followed by a number giving a repeat
-count.  With all types except C<"a">, C<"A">, C<"b">, C<"B">, C<"h">, C<"H">, and C<"P"> the
-pack function will gobble up that many values from the LIST.  A C<*> for the
-repeat count means to use however many items are left.  The C<"a"> and C<"A">
-types gobble just one value, but pack it as a string of length count,
-padding with nulls or spaces as necessary.  (When unpacking, C<"A"> strips
-trailing spaces and nulls, but C<"a"> does not.)  Likewise, the C<"b"> and C<"B">
-fields pack a string that many bits long.  The C<"h"> and C<"H"> fields pack a
-string that many nybbles long.  The C<"p"> type packs a pointer to a null-
-terminated string.  You are responsible for ensuring the string is not a
-temporary value (which can potentially get deallocated before you get
-around to using the packed result).  The C<"P"> packs a pointer to a structure
-of the size indicated by the length. A NULL pointer is created if the 
-corresponding value for C<"p"> or C<"P"> is C<undef>.
-Real numbers (floats and doubles) are
-in the native machine format only; due to the multiplicity of floating
-formats around, and the lack of a standard "network" representation, no
-facility for interchange has been made.  This means that packed floating
-point data written on one machine may not be readable on another - even if
-both use IEEE floating point arithmetic (as the endian-ness of the memory
-representation is not part of the IEEE spec).  Note that Perl uses doubles
-internally for all numeric calculation, and converting from double into
-float and thence back to double again will lose precision (i.e.,
-C<unpack("f", pack("f", $foo)>) will not in general equal C<$foo>).
+count.  With all types except C<"a">, C<"A">, C<"Z">, C<"b">, C<"B">, C<"h">,
+C<"H">, and C<"P"> the pack function will gobble up that many values from
+the LIST.  A C<*> for the repeat count means to use however many items are
+left.
+
+=item *
+
+The C<"a">, C<"A">, and C<"Z"> types gobble just one value, but pack it as a
+string of length count, padding with nulls or spaces as necessary.  When
+unpacking, C<"A"> strips trailing spaces and nulls, C<"Z"> strips everything
+after the first null, and C<"a"> returns data verbatim.
+
+=item *
+
+Likewise, the C<"b"> and C<"B"> fields pack a string that many bits long.
+
+=item *
+
+The C<"h"> and C<"H"> fields pack a string that many nybbles long.
+
+=item *
+
+The C<"p"> type packs a pointer to a null-terminated string.  You are
+responsible for ensuring the string is not a temporary value (which can
+potentially get deallocated before you get around to using the packed result).
+The C<"P"> type packs a pointer to a structure of the size indicated by the
+length. A NULL pointer is created if the corresponding value for C<"p"> or
+C<"P"> is C<undef>.
+
+=item *
+
+The integer types C<"s">, C<"S">, C<"l">, and C<"L"> may be
+immediately followed by a C<"!"> to signify native shorts or longs--as
+you can see from above for example a bare C<"l"> does mean exactly 32
+bits, the native C<long> (as seen by the local C compiler) may be
+larger.  This is an issue mainly in 64-bit platforms.  You can see
+whether using C<"!"> makes any difference by
+
+       print length(pack("s")), " ", length(pack("s!")), "\n";
+       print length(pack("l")), " ", length(pack("l!")), "\n";
+
+C<"i!"> and C<"I!"> also work but only because of completeness;
+they are identical to C<"i"> and C<"I">.
+
+The actual sizes (in bytes) of native shorts, ints, and longs on
+the platform where Perl was built are also available via L<Config>:
+
+       use Config;
+       print $Config{shortsize}, "\n";
+       print $Config{intsize}, "\n";
+       print $Config{longsize}, "\n";
+
+=item *
+
+The integer formats C<"s">, C<"S">, C<"i">, C<"I">, C<"l">, and C<"L">
+are inherently non-portable between processors and operating systems
+because they obey the native byteorder and endianness.  For example a
+4-byte integer 0x87654321 (2271560481 decimal) be ordered natively
+(arranged in and handled by the CPU registers) into bytes as
+       0x12 0x34 0x56 0x78     # little-endian
+       0x78 0x56 0x34 0x12     # big-endian
+Basically, the Intel, Alpha, and VAX CPUs and little-endian, while
+everybody else, for example Motorola m68k/88k, PPC, Sparc, HP PA,
+Power, and Cray are big-endian.  MIPS can be either: Digital used it
+in little-endian mode, SGI uses it in big-endian mode.
+
+The names `big-endian' and `little-endian' are joking references to
+the classic "Gulliver's Travels" (via the paper "On Holy Wars and a
+Plea for Peace" by Danny Cohen, USC/ISI IEN 137, April 1, 1980) and
+the egg-eating habits of the lilliputs.
+Some systems may even have weird byte orders such as
+       0x56 0x78 0x12 0x34
+       0x34 0x12 0x78 0x56
+You can see your system's preference with
+
+       print join(" ", map { sprintf "%#02x", $_ }
+                            unpack("C*",pack("L",0x12345678))), "\n";
+
+The byteorder on the platform where Perl was built is also available
+via L<Config>:
+
+       use Config;
+       print $Config{byteorder}, "\n";
+
+Byteorders C<'1234'> and C<'12345678'> are little-endian, C<'4321'>
+and C<'87654321'> are big-endian.
+
+If you want portable packed integers use the formats C<"n">, C<"N">,
+C<"v">, and C<"V">, their byte endianness and size is known.
+
+=item *
+
+Real numbers (floats and doubles) are in the native machine format only;
+due to the multiplicity of floating formats around, and the lack of a
+standard "network" representation, no facility for interchange has been
+made.  This means that packed floating point data written on one machine
+may not be readable on another - even if both use IEEE floating point
+arithmetic (as the endian-ness of the memory representation is not part
+of the IEEE spec).
+
+Note that Perl uses doubles internally for all numeric calculation, and
+converting from double into float and thence back to double again will
+lose precision (i.e., C<unpack("f", pack("f", $foo)>) will not in general
+equal C<$foo>).
+
+=back
 
 Examples:
 
@@ -2656,29 +2812,38 @@ Examples:
     $foo = pack("i9pl", gmtime);
     # a real struct tm (on my system anyway)
 
+    $utmp_template = "Z8 Z8 Z16 L";
+    $utmp = pack($utmp_template, @utmp1);
+    # a struct utmp (BSDish)
+
+    @utmp2 = unpack($utmp_template, $utmp);
+    # "@utmp1" eq "@utmp2"
+
     sub bintodec {
        unpack("N", pack("B32", substr("0" x 32 . shift, -32)));
     }
 
-The same template may generally also be used in the unpack function.
+The same template may generally also be used in unpack().
 
 =item package 
 
 =item package NAMESPACE
 
 Declares the compilation unit as being in the given namespace.  The scope
-of the package declaration is from the declaration itself through the end of
-the enclosing block (the same scope as the C<local()> operator).  All further
-unqualified dynamic identifiers will be in this namespace.  A package
-statement affects only dynamic variables--including those you've used
-C<local()> on--but I<not> lexical variables created with C<my()>.  Typically it
-would be the first declaration in a file to be included by the C<require>
-or C<use> operator.  You can switch into a package in more than one place;
-it merely influences which symbol table is used by the compiler for the
-rest of that block.  You can refer to variables and filehandles in other
-packages by prefixing the identifier with the package name and a double
-colon:  C<$Package::Variable>.  If the package name is null, the C<main>
-package as assumed.  That is, C<$::sail> is equivalent to C<$main::sail>.
+of the package declaration is from the declaration itself through the end
+of the enclosing block, file, or eval (the same as the C<my()> operator).
+All further unqualified dynamic identifiers will be in this namespace.
+A package statement affects only dynamic variables--including those
+you've used C<local()> on--but I<not> lexical variables, which are created
+with C<my()>.  Typically it would be the first declaration in a file to
+be included by the C<require> or C<use> operator.  You can switch into a
+package in more than one place; it merely influences which symbol table
+is used by the compiler for the rest of that block.  You can refer to
+variables and filehandles in other packages by prefixing the identifier
+with the package name and a double colon:  C<$Package::Variable>.
+If the package name is null, the C<main> package as assumed.  That is,
+C<$::sail> is equivalent to C<$main::sail> (as well as to C<$main'sail>,
+still seen in older code).
 
 If NAMESPACE is omitted, then there is no current package, and all
 identifiers must be fully qualified or lexicals.  This is stricter
@@ -2707,14 +2872,13 @@ See L<perlvar/$^F>.
 =item pop
 
 Pops and returns the last value of the array, shortening the array by
-1.  Has a similar effect to
+one element.  Has a similar effect to
 
     $tmp = $ARRAY[$#ARRAY--];
 
 If there are no elements in the array, returns the undefined value.
-If ARRAY is omitted, pops the
-C<@ARGV> array in the main program, and the C<@_> array in subroutines, just
-like C<shift()>.
+If ARRAY is omitted, pops the C<@ARGV> array in the main program, and
+the C<@_> array in subroutines, just like C<shift()>.
 
 =item pos SCALAR
 
@@ -2734,20 +2898,20 @@ L<perlop>.
 
 Prints a string or a comma-separated list of strings.  Returns TRUE
 if successful.  FILEHANDLE may be a scalar variable name, in which case
-the variable contains the name of or a reference to the filehandle, thus introducing one
-level of indirection.  (NOTE: If FILEHANDLE is a variable and the next
-token is a term, it may be misinterpreted as an operator unless you
-interpose a C<+> or put parentheses around the arguments.)  If FILEHANDLE is
-omitted, prints by default to standard output (or to the last selected
-output channel--see L</select>).  If LIST is also omitted, prints C<$_> to
-the currently selected output channel.  To set the default output channel to something other than
-STDOUT use the select operation.  Note that, because print takes a
-LIST, anything in the LIST is evaluated in list context, and any
-subroutine that you call will have one or more of its expressions
-evaluated in list context.  Also be careful not to follow the print
-keyword with a left parenthesis unless you want the corresponding right
-parenthesis to terminate the arguments to the print--interpose a C<+> or
-put parentheses around all the arguments.
+the variable contains the name of or a reference to the filehandle, thus
+introducing one level of indirection.  (NOTE: If FILEHANDLE is a variable
+and the next token is a term, it may be misinterpreted as an operator
+unless you interpose a C<+> or put parentheses around the arguments.)
+If FILEHANDLE is omitted, prints by default to standard output (or to the
+last selected output channel--see L</select>).  If LIST is also omitted,
+prints C<$_> to the currently selected output channel.  To set the default
+output channel to something other than STDOUT use the select operation.
+Note that, because print takes a LIST, anything in the LIST is evaluated
+in list context, and any subroutine that you call will have one or
+more of its expressions evaluated in list context.  Also be careful
+not to follow the print keyword with a left parenthesis unless you want
+the corresponding right parenthesis to terminate the arguments to the
+print--interpose a C<+> or put parentheses around all the arguments.
 
 Note that if you're storing FILEHANDLES in an array or other expression,
 you will have to use a block returning its value instead:
@@ -2775,12 +2939,12 @@ Returns the prototype of a function as a string (or C<undef> if the
 function has no prototype).  FUNCTION is a reference to, or the name of,
 the function whose prototype you want to retrieve.
 
-If FUNCTION is a string starting with C<CORE::>, the rest is taken as
-a name for Perl builtin.  If builtin is not I<overridable> (such as
+If FUNCTION is a string starting with C<CORE::>, the rest is taken as a
+name for Perl builtin.  If the builtin is not I<overridable> (such as
 C<qw//>) or its arguments cannot be expressed by a prototype (such as
-C<system()>) - in other words, the builtin does not behave like a Perl
-function - returns C<undef>.  Otherwise, the string describing the
-equivalent prototype is returned.
+C<system()>) returns C<undef> because the builtin does not really behave
+like a Perl function.  Otherwise, the string describing the equivalent
+prototype is returned.
 
 =item push ARRAY,LIST
 
@@ -2861,10 +3025,17 @@ C<chdir()> there, it would have been testing the wrong file.
 
 =item readline EXPR
 
-Reads from the filehandle whose typeglob is contained in EXPR.  In scalar context, a single line
-is read and returned.  In list context, reads until end-of-file is
-reached and returns a list of lines (however you've defined lines
-with C<$/> or C<$INPUT_RECORD_SEPARATOR>).
+Reads from the filehandle whose typeglob is contained in EXPR.  In scalar
+context, each call reads and returns the next line, until end-of-file is
+reached, whereupon the subsequent call returns undef.  In list context,
+reads until end-of-file is reached and returns a list of lines.  Note that
+the notion of "line" used here is however you may have defined it
+with C<$/> or C<$INPUT_RECORD_SEPARATOR>).  See L<perlvar/"$/">.
+
+When C<$/> is set to C<undef>, when readline() is in scalar
+context (i.e. file slurp mode), and when an empty file is read, it
+returns C<''> the first time, followed by C<undef> subsequently.
+
 This is the internal function implementing the C<E<lt>EXPRE<gt>>
 operator, but you can use it directly.  The C<E<lt>EXPRE<gt>>
 operator is discussed in more detail in L<perlop/"I/O Operators">.
@@ -2892,7 +3063,7 @@ This is the internal function implementing the C<qx/EXPR/>
 operator, but you can use it directly.  The C<qx/EXPR/>
 operator is discussed in more detail in L<perlop/"I/O Operators">.
 
-=item recv SOCKET,SCALAR,LEN,FLAGS
+=item recv SOCKET,SCALAR,LENGTH,FLAGS
 
 Receives a message on a socket.  Attempts to receive LENGTH bytes of
 data into variable SCALAR from the specified SOCKET filehandle.
@@ -2907,7 +3078,7 @@ See L<perlipc/"UDP: Message Passing"> for examples.
 =item redo
 
 The C<redo> command restarts the loop block without evaluating the
-conditional again.  The L</continue> block, if any, is not executed.  If
+conditional again.  The C<continue> block, if any, is not executed.  If
 the LABEL is omitted, the command refers to the innermost enclosing
 loop.  This command is normally used by programs that want to lie to
 themselves about what was just input:
@@ -2930,13 +3101,12 @@ themselves about what was just input:
     }
 
 C<redo> cannot be used to retry a block which returns a value such as
-C<eval {}>, C<sub {}> or C<do {}>.
+C<eval {}>, C<sub {}> or C<do {}>, and should not be used to exit
+a grep() or map() operation.
 
-See also L</continue> for an illustration of how L</last>, L</next>, and
+See also L</continue> for an illustration of how C<last>, C<next>, and
 C<redo> work.
 
-See also L<perlsyn>.
-
 =item ref EXPR
 
 =item ref
@@ -2959,16 +3129,24 @@ name is returned instead.  You can think of C<ref()> as a C<typeof()> operator.
     if (ref($r) eq "HASH") {
        print "r is a reference to a hash.\n";
     }
-    if (!ref($r)) {
+    unless (ref($r)) {
        print "r is not a reference at all.\n";
     }
+    if (UNIVERSAL::isa($r, "HASH")) {  # for subclassing
+       print "r is a reference to something that isa hash.\n";
+    } 
 
 See also L<perlref>.
 
 =item rename OLDNAME,NEWNAME
 
-Changes the name of a file.  Returns C<1> for success, C<0> otherwise.  Will
-not work across file system boundaries.
+Changes the name of a file.  Returns C<1> for success, C<0> otherwise.
+Behavior of this function varies wildly depending on your system
+implementation.  For example, it will usually not work across file system
+boundaries, even though the system I<mv> command sometimes compensates
+for this.  Other restrictions include whether it works on directories,
+open files, or pre-existing files.  Check L<perlport> and either the
+rename(2) manpage or equivalent system documentation for details.
 
 =item require EXPR
 
@@ -3051,12 +3229,13 @@ only variables or searches in the current package.  Always returns
 
     reset 'X';         # reset all X variables
     reset 'a-z';       # reset lower case variables
-    reset;             # just reset ?? searches
+    reset;             # just reset ?one-time? searches
 
 Resetting C<"A-Z"> is not recommended because you'll wipe out your
-C<@ARGV> and C<@INC> arrays and your C<%ENV> hash.  Resets only package variables--lexical variables
-are unaffected, but they clean themselves up on scope exit anyway,
-so you'll probably want to use them instead.  See L</my>.
+C<@ARGV> and C<@INC> arrays and your C<%ENV> hash.  Resets only package
+variables--lexical variables are unaffected, but they clean themselves
+up on scope exit anyway, so you'll probably want to use them instead.
+See L</my>.
 
 =item return EXPR
 
@@ -3066,17 +3245,18 @@ Returns from a subroutine, C<eval()>, or C<do FILE> with the value
 given in EXPR.  Evaluation of EXPR may be in list, scalar, or void
 context, depending on how the return value will be used, and the context
 may vary from one execution to the next (see C<wantarray()>).  If no EXPR
-is given, returns an empty list in list context, an undefined value in
-scalar context, or nothing in a void context.
+is given, returns an empty list in list context, the undefined value in
+scalar context, and (of course) nothing at all in a void context.
 
-(Note that in the absence of a return, a subroutine, eval, or do FILE
-will automatically return the value of the last expression evaluated.)
+(Note that in the absence of a explicit C<return>, a subroutine, eval,
+or do FILE will automatically return the value of the last expression
+evaluated.)
 
 =item reverse LIST
 
 In list context, returns a list value consisting of the elements
 of LIST in the opposite order.  In scalar context, concatenates the
-elements of LIST, and returns a string value with all the characters
+elements of LIST and returns a string value with all characters
 in the opposite order.
 
     print reverse <>;          # line tac, last line first
@@ -3088,7 +3268,7 @@ This operator is also handy for inverting a hash, although there are some
 caveats.  If a value is duplicated in the original hash, only one of those
 can be represented as a key in the inverted hash.  Also, this has to
 unwind one hash and build a whole new one, which may take some time
-on a large hash.
+on a large hash, such as from a DBM file.
 
     %by_name = reverse %by_address;    # Invert the hash
 
@@ -3101,7 +3281,7 @@ C<readdir()> routine on DIRHANDLE.
 
 =item rindex STR,SUBSTR
 
-Works just like index except that it returns the position of the LAST
+Works just like index() except that it returns the position of the LAST
 occurrence of SUBSTR in STR.  If POSITION is specified, returns the
 last occurrence at or before that position.
 
@@ -3125,11 +3305,27 @@ of EXPR.
     @counts = ( scalar @a, scalar @b, scalar @c );
 
 There is no equivalent operator to force an expression to
-be interpolated in list context because it's in practice never
+be interpolated in list context because in practice, this is never
 needed.  If you really wanted to do so, however, you could use
 the construction C<@{[ (some expression) ]}>, but usually a simple
 C<(some expression)> suffices.
 
+Wince C<scalar> is unary operator, if you accidentally use for EXPR a
+parenthesized list, this behaves as a scalar comma expression, evaluating
+all but the last element in void context and returning the final element
+evaluated in scalar context.  This is seldom what you want.
+
+The following single statement:
+
+       print uc(scalar(&foo,$bar)),$baz;
+
+is the moral equivalent of these two:
+
+       &foo;
+       print(uc($bar),$baz);
+
+See L<perlop> for more details on unary operators and the comma operator.
+
 =item seek FILEHANDLE,POSITION,WHENCE
 
 Sets FILEHANDLE's position, just like the C<fseek()> call of C<stdio()>.
@@ -3144,10 +3340,10 @@ If you want to position file for C<sysread()> or C<syswrite()>, don't use
 C<seek()> -- buffering makes its effect on the file's system position
 unpredictable and non-portable.  Use C<sysseek()> instead.
 
-On some systems you have to do a seek whenever you switch between reading
-and writing.  Amongst other things, this may have the effect of calling
-stdio's clearerr(3).  A WHENCE of C<1> (C<SEEK_CUR>) is useful for not moving
-the file position:
+Due to the rules and rigors of ANSI C, on some systems you have to do a
+seek whenever you switch between reading and writing.  Amongst other
+things, this may have the effect of calling stdio's clearerr(3).
+A WHENCE of C<1> (C<SEEK_CUR>) is useful for not moving the file position:
 
     seek(TEST,0,1);
 
@@ -3294,7 +3490,7 @@ Sends a message on a socket.  Takes the same flags as the system call
 of the same name.  On unconnected sockets you must specify a
 destination to send TO, in which case it does a C C<sendto()>.  Returns
 the number of characters sent, or the undefined value if there is an
-error.
+error.  The C system call sendmsg(2) is currently unimplemented.
 See L<perlipc/"UDP: Message Passing"> for examples.
 
 =item setpgrp PID,PGRP
@@ -3303,7 +3499,7 @@ Sets the current process group for the specified PID, C<0> for the current
 process.  Will produce a fatal error if used on a machine that doesn't
 implement setpgrp(2).  If the arguments are omitted, it defaults to
 C<0,0>.  Note that the POSIX version of C<setpgrp()> does not accept any
-arguments, so only setpgrp C<0,0> is portable.
+arguments, so only C<setpgrp(0,0)> is portable.  See also C<POSIX::setsid()>.
 
 =item setpriority WHICH,WHO,PRIORITY
 
@@ -3359,7 +3555,8 @@ detaching from it.  When reading, VAR must be a variable that will
 hold the data read.  When writing, if STRING is too long, only SIZE
 bytes are used; if STRING is too short, nulls are written to fill out
 SIZE bytes.  Return TRUE if successful, or FALSE if there is an error.
-See also C<IPC::SysV> documentation.
+See also C<IPC::SysV> documentation and the C<IPC::Shareable> module
+from CPAN.
 
 =item shutdown SOCKET,HOW
 
@@ -3406,7 +3603,7 @@ busy multitasking system.
 
 For delays of finer granularity than one second, you may use Perl's
 C<syscall()> interface to access setitimer(2) if your system supports it,
-or else see L</select()> above.
+or else see L</select> above.
 
 See also the POSIX module's C<sigpause()> function.
 
@@ -3415,7 +3612,7 @@ See also the POSIX module's C<sigpause()> function.
 Opens a socket of the specified kind and attaches it to filehandle
 SOCKET.  DOMAIN, TYPE, and PROTOCOL are specified the same as for the
 system call of the same name.  You should "C<use Socket;>" first to get
-the proper definitions imported.  See the example in L<perlipc/"Sockets: Client/Server Communication">.
+the proper definitions imported.  See the examples in L<perlipc/"Sockets: Client/Server Communication">.
 
 =item socketpair SOCKET1,SOCKET2,DOMAIN,TYPE,PROTOCOL
 
@@ -3707,6 +3904,7 @@ In addition, Perl permits the following widely-supported conversions:
    %X  like %x, but using upper-case letters
    %E  like %e, but using an upper-case "E"
    %G  like %g, but with an upper-case "E" (if applicable)
+   %b  an unsigned integer, in binary
    %p  a pointer (outputs the Perl value's address in hexadecimal)
    %n  special: *stores* the number of characters output so far
         into the next variable in the parameter list 
@@ -3754,7 +3952,11 @@ See L<perllocale>.
 =item sqrt
 
 Return the square root of EXPR.  If EXPR is omitted, returns square
-root of C<$_>.
+root of C<$_>.  Only works on non-negative operands, unless you've
+loaded the standard Math::Complex module.
+
+    use Math::Complex;
+    print sqrt(-2);    # prints 1.4142135623731i
 
 =item srand EXPR
 
@@ -3844,10 +4046,26 @@ last stat or filetest are returned.  Example:
 
 (This works on machines only for which the device number is negative under NFS.)
 
+Because the mode contains both the file type and its permissions, you
+should mask off the file type portion and (s)printf using a C<"%o"> 
+if you want to see the real permissions.
+
+    $mode = (stat($filename))[2];
+    printf "Permissions are %04o\n", $mode & 07777;
+
+
 In scalar context, C<stat()> returns a boolean value indicating success
 or failure, and, if successful, sets the information associated with
 the special filehandle C<_>.
 
+The File::stat module provides a convenient, by-name access mechanism:
+
+    use File::stat;
+    $sb = stat($filename);
+    printf "File is %s, size is %s, perm %04o, mtime %s\n", 
+       $filename, $sb->size, $sb->mode & 07777,
+       scalar localtime $sb->mtime;
+
 =item study SCALAR
 
 =item study
@@ -3873,9 +4091,9 @@ before any line containing a certain pattern:
 
     while (<>) {
        study;
-       print ".IX foo\n" if /\bfoo\b/;
-       print ".IX bar\n" if /\bbar\b/;
-       print ".IX blurfl\n" if /\bblurfl\b/;
+       print ".IX foo\n"       if /\bfoo\b/;
+       print ".IX bar\n"       if /\bbar\b/;
+       print ".IX blurfl\n"    if /\bblurfl\b/;
        # ...
        print;
     }
@@ -3936,16 +4154,16 @@ If you specify a substring that is partly outside the string, the part
 within the string is returned.    If the substring is totally outside
 the string a warning is produced.
 
-You can use the C<substr()> function
-as an lvalue, in which case EXPR must be an lvalue.  If you assign
-something shorter than LEN, the string will shrink, and if you assign
-something longer than LEN, the string will grow to accommodate it.  To
-keep the string the same length you may need to pad or chop your value
-using C<sprintf()>.
+You can use the substr() function as an lvalue, in which case EXPR
+must itself be an lvalue.  If you assign something shorter than LEN,
+the string will shrink, and if you assign something longer than LEN,
+the string will grow to accommodate it.  To keep the string the same
+length you may need to pad or chop your value using C<sprintf()>.
 
-An alternative to using C<substr()> as an lvalue is to specify the
+An alternative to using substr() as an lvalue is to specify the
 replacement string as the 4th argument.  This allows you to replace
-parts of the EXPR and return what was there before in one operation.
+parts of the EXPR and return what was there before in one operation,
+just as you can with splice().
 
 =item symlink OLDFILE,NEWFILE
 
@@ -3954,7 +4172,7 @@ Returns C<1> for success, C<0> otherwise.  On systems that don't support
 symbolic links, produces a fatal error at run time.  To check for that,
 use eval:
 
-    $symlink_exists =  eval { symlink("",""); 1 };
+    $symlink_exists = eval { symlink("",""); 1 };
 
 =item syscall LIST
 
@@ -4015,12 +4233,12 @@ the PERMS argument to C<sysopen()>, Perl uses the octal value C<0666>.
 These permission values need to be in octal, and are modified by your
 process's current C<umask>.
 
-Seldom if ever use C<0644> as argument to C<sysopen()> because that
-takes away the user's option to have a more permissive umask.  Better
-to omit it.  See the perlfunc(1) entry on C<umask> for more on this.
+You should seldom if ever use C<0644> as argument to C<sysopen()>, because
+that takes away the user's option to have a more permissive umask.
+Better to omit it.  See the perlfunc(1) entry on C<umask> for more
+on this.
 
-The C<IO::File> module provides a more object-oriented approach, if you're
-into that kind of thing.
+See L<perlopentut> for a kinder, gentler explanation of opening files.
 
 =item sysread FILEHANDLE,SCALAR,LENGTH,OFFSET
 
@@ -4042,6 +4260,10 @@ string.  A positive OFFSET greater than the length of SCALAR results
 in the string being padded to the required size with C<"\0"> bytes before
 the result of the read is appended.
 
+There is no syseof() function, which is ok, since eof() doesn't work
+very well on device files (like ttys) anyway.  Use sysread() and check
+ofr a return value for 0 to decide whether you're done.
+
 =item sysseek FILEHANDLE,POSITION,WHENCE
 
 Sets FILEHANDLE's system position using the system call lseek(2).  It
@@ -4063,7 +4285,7 @@ the new position.
 
 =item system PROGRAM LIST
 
-Does exactly the same thing as "C<exec LIST>" except that a fork is done
+Does exactly the same thing as "C<exec LIST>", except that a fork is done
 first, and the parent process waits for the child process to complete.
 Note that argument processing varies depending on the number of
 arguments.  If there is more than one argument in LIST, or if LIST is
@@ -4130,7 +4352,9 @@ case the SCALAR is empty you can use OFFSET but only zero offset.
 
 Returns the current position for FILEHANDLE.  FILEHANDLE may be an
 expression whose value gives the name of the actual filehandle.  If
-FILEHANDLE is omitted, assumes the file last read.
+FILEHANDLE is omitted, assumes the file last read.  
+
+There is no C<systell()> function.  Use C<sysseek(FH, 0, 1)> for that.
 
 =item telldir DIRHANDLE
 
@@ -4211,13 +4435,13 @@ A class implementing a scalar should have the following methods:
     DESTROY this
 
 Not all methods indicated above need be implemented.  See L<perltie>,
-L<Tie::Hash>, L<Tie::Array>, L<Tie::Scalar> and L<Tie::Handle>.
+L<Tie::Hash>, L<Tie::Array>, L<Tie::Scalar>, and L<Tie::Handle>.
 
 Unlike C<dbmopen()>, the C<tie()> function will not use or require a module
 for you--you need to do that explicitly yourself.  See L<DB_File>
 or the F<Config> module for interesting C<tie()> implementations.
 
-For further details see L<perltie>, L<tied VARIABLE>.
+For further details see L<perltie>, L<"tied VARIABLE">.
 
 =item tied VARIABLE
 
@@ -4272,7 +4496,8 @@ If EXPR is omitted, uses C<$_>.
 Returns the value of EXPR with the first character
 in uppercase (titlecase in Unicode).  This is
 the internal function implementing the C<\u> escape in double-quoted strings.
-Respects current LC_CTYPE locale if C<use locale> in force.  See L<perllocale>.
+Respects current LC_CTYPE locale if C<use locale> in force.  See L<perllocale>
+and L<utf8>.
 
 If EXPR is omitted, uses C<$_>.
 
@@ -4285,7 +4510,7 @@ If EXPR is omitted, merely returns the current umask.
 
 The Unix permission C<rwxr-x---> is represented as three sets of three
 bits, or three octal digits: C<0750> (the leading 0 indicates octal
-and isn't one of the the digits).  The C<umask> value is such a number
+and isn't one of the digits).  The C<umask> value is such a number
 representing disabled permissions bits.  The permission (or "mode")
 values you pass C<mkdir> or C<sysopen> are modified by your umask, so
 even if you tell C<sysopen> to create a file with permissions C<0777>,
@@ -4339,13 +4564,6 @@ parameter.  Examples:
 
 Note that this is a unary operator, not a list operator.
 
-=item unless (EXPR) BLOCK
-
-The negative counterpart of L</if>.  If the EXPR returns false the
-BLOCK is entered.
-
-See also L<perlsyn>.
-
 =item unlink LIST
 
 =item unlink
@@ -4387,14 +4605,25 @@ themselves.  Default is a 16-bit checksum.  For example, the following
 computes the same number as the System V sum program:
 
     while (<>) {
-       $checksum += unpack("%16C*", $_);
+       $checksum += unpack("%32C*", $_);
     }
-    $checksum %= 65536;
+    $checksum %= 65535;
 
 The following efficiently counts the number of set bits in a bit vector:
 
     $setbits = unpack("%32b*", $selectmask);
 
+The C<"p"> and C<"P"> formats should be used with care.  Since Perl
+has no way of checking whether the value passed to C<unpack()>
+corresponds to a valid memory location, passing a pointer value that's
+not known to be valid is likely to have disastrous consequences.
+
+See L</pack> for more examples.
+
+=item untie VARIABLE
+
+Breaks the binding between a variable and a package.  (See C<tie()>.)
+
 =item unshift ARRAY,LIST
 
 Does the opposite of a C<shift()>.  Or the opposite of a C<push()>,
@@ -4407,21 +4636,6 @@ Note the LIST is prepended whole, not one element at a time, so the
 prepended elements stay in the same order.  Use C<reverse()> to do the
 reverse.
 
-=item until (EXPR) BLOCK
-
-=item do BLOCK until (EXPR)
-
-Enter BLOCK until EXPR returns false.  The first form may avoid entering
-the BLOCK, the second form enters the BLOCK at least once.
-
-See L</do>, L</while>, and L</for>.
-
-See also L<perlsyn>.
-
-=item untie VARIABLE
-
-Breaks the binding between a variable and a package.  (See C<tie()>.)
-
 =item use Module LIST
 
 =item use Module
@@ -4518,8 +4732,15 @@ subject to change in future versions of perl, but it is guaranteed to
 be the same order as either the C<keys()> or C<each()> function would
 produce on the same (unmodified) hash.
 
-As a side effect, it resets HASH's iterator.  See also C<keys()>, C<each()>,
-and C<sort()>.
+Note that you cannot modify the values of a hash this way, because the
+returned list is just a copy.  You need to use a hash slice for that, 
+since it's lvaluable in a way that values() is not.
+
+    for (values %hash)             { s/foo/bar/g }   # FAILS!
+    for (@hash{keys %hash}) { s/foo/bar/g }   # ok
+
+As a side effect, calling values() resets the HASH's internal iterator.
+See also C<keys()>, C<each()>, and C<sort()>.
 
 =item vec EXPR,OFFSET,BITS
 
@@ -4534,7 +4755,7 @@ the correct precedence as in
 
 Vectors created with C<vec()> can also be manipulated with the logical
 operators C<|>, C<&>, and C<^>, which will assume a bit vector operation is
-desired when both operands are strings.
+desired when both operands are strings.  See L<perlop/"Bitwise String Operators">.
 
 The following code will build up an ASCII string saying C<'PerlPerlPerl'>.
 The comments show the string after each step. Note that this code works
@@ -4563,30 +4784,35 @@ If you know the exact length in bits, it can be used in place of the C<*>.
 
 =item wait
 
-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<$?>.  Note that a return value of C<-1> could mean that
-child processes are being automatically reaped, as described in L<perlipc>.
+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 rketurned in C<$?>.
+Note that a return value of C<-1> could mean that child processes are
+being automatically reaped, as described in L<perlipc>.
 
 =item waitpid PID,FLAGS
 
-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.  The
-status is returned in C<$?>.  If you say
+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<$?>.  If you say
 
     use POSIX ":sys_wait_h";
     #...
-    waitpid(-1,&WNOHANG);
+    do { 
+       $kid = waitpid(-1,&WNOHANG);
+    } until $kid == -1;
 
-then you can do a non-blocking wait for any process.  Non-blocking wait
-is available on machines supporting either the waitpid(2) or
-wait4(2) system calls.  However, waiting for a particular pid with
-FLAGS of C<0> is implemented everywhere.  (Perl emulates the system call
-by remembering the status values of processes that have exited but have
-not been harvested by the Perl script yet.)
+then you can do a non-blocking wait for all pending zombie processes.
+Non-blocking wait is available on machines supporting either the
+waitpid(2) or wait4(2) system calls.  However, waiting for a particular
+pid with FLAGS of C<0> is implemented everywhere.  (Perl emulates the
+system call by remembering the status values of processes that have
+exited but have not been harvested by the Perl script yet.)
 
-Note that a return value of C<-1> could mean that child processes are being
-automatically reaped.  See L<perlipc> for details, and for other examples.
+Note that on some systems, a return value of C<-1> could mean that child
+processes are being automatically reaped.  See L<perlipc> for details,
+and for other examples.
 
 =item wantarray
 
@@ -4639,16 +4865,8 @@ warnings (even the so-called mandatory ones).  An example:
     warn "\$foo is alive and $foo!";     # does show up
 
 See L<perlvar> for details on setting C<%SIG> entries, and for more
-examples.
-
-=item while (EXPR) BLOCK
-
-=item do BLOCK while (EXPR)
-
-Enter BLOCK while EXPR is true.  The first form may avoid entering the
-BLOCK, the second form enters the BLOCK at least once.
-
-See also L<perlsyn>, L</for>, L</until>, and L</continue>.
+examples.  See the Carp module for other kinds of warnings using its
+carp() and cluck() functions.
 
 =item write FILEHANDLE