summaryrefslogtreecommitdiff
path: root/pod/perlfunc.pod
diff options
context:
space:
mode:
Diffstat (limited to 'pod/perlfunc.pod')
-rw-r--r--pod/perlfunc.pod51
1 files changed, 27 insertions, 24 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index eb7276a3b4..c4de4a39ae 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -35,11 +35,11 @@ operator or unary operator, and precedence does matter. And whitespace
between the function and left parenthesis doesn't count--so you need to
be careful sometimes:
- print 1+2+3; # Prints 6.
- print(1+2) + 3; # Prints 3.
- print (1+2)+3; # Also prints 3!
- print +(1+2)+3; # Prints 6.
- print ((1+2)+3); # Prints 6.
+ print 1+2+4; # Prints 7.
+ print(1+2) + 4; # Prints 3.
+ print (1+2)+4; # Also prints 3!
+ print +(1+2)+4; # Prints 7.
+ print ((1+2)+4); # Prints 7.
If you run Perl with the B<-w> switch it can warn you about this. For
example, the third line above produces:
@@ -1123,21 +1123,22 @@ value is taken as the name of the filehandle.
=item flock FILEHANDLE,OPERATION
Calls flock(2), or an emulation of it, on FILEHANDLE. Returns TRUE for
-success, FALSE on failure. Will produce a fatal error if used on a
-machine that doesn't implement flock(2), fcntl(2) locking, or lockf(3).
-flock() is Perl's portable file locking interface, although it will lock
-only entire files, not records.
+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). flock()
+is Perl's portable file locking interface, although it locks only entire
+files, not records.
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
-you can use the symbolic names if you pull them in with an explicit
-request to the Fcntl module. The names can be requested as a group with
-the :flock tag (or they can be requested individually, of course).
-LOCK_SH requests a shared lock, LOCK_EX requests an exclusive lock, and
-LOCK_UN releases a previously requested lock. If LOCK_NB is added to
-LOCK_SH or LOCK_EX then flock() will return immediately rather than
-blocking waiting for the lock (check the return status to see if you got
-it).
+you can use the symbolic names if import them from the Fcntl module,
+either individually, or as a group using the ':flock' tag. LOCK_SH
+requests a shared lock, LOCK_EX requests an exclusive lock, and LOCK_UN
+releases a previously requested lock. If LOCK_NB is added to LOCK_SH or
+LOCK_EX then 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.
Note that the emulation built with lockf(3) doesn't provide shared
locks, and it requires that FILEHANDLE be open with write intent. These
@@ -1436,9 +1437,11 @@ Returns the socket option requested, or undefined if there is an error.
=item glob
-Returns the value of EXPR with filename expansions such as a shell
-would do. This is the internal function implementing the <*.c>
-operator, except it's easier to use. If EXPR is omitted, $_ is used.
+Returns the value of EXPR with filename expansions such as a shell 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, $_ is used.
+The C<E<lt>*.cE<gt>> operator is discussed in more detail in
+L<perlop/"I/O Operators">.
=item gmtime EXPR
@@ -2299,7 +2302,7 @@ Generalized quotes. See L<perlop>.
=item quotemeta
-Returns the value of EXPR with with all non-alphanumeric
+Returns the value of EXPR with all non-alphanumeric
characters backslashed. (That is, all characters not matching
C</[A-Za-z_0-9]/> will be preceded by a backslash in the
returned string, regardless of any locale settings.)
@@ -2499,9 +2502,9 @@ so you'll probably want to use them instead. See L</my>.
=item return LIST
-Returns from a subroutine or eval with the value specified. (Note that
-in the absence of a return a subroutine or eval() will automatically
-return the value of the last expression evaluated.)
+Returns from a subroutine, eval(), or do FILE with the value specified.
+(Note that in the absence of a return, a subroutine, eval, or do FILE
+will automatically return the value of the last expression evaluated.)
=item reverse LIST