X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlfunc.pod;h=8f2222a7db21aec3e103abf277de310d207a50ea;hb=d44161bfbb2e964e9675634d6bf5e566d1d1d4f7;hp=3686736fcfc7c45cf42a183319973984640fe592;hpb=b49f3be6643e5cc849effc933e4e4e100d534a4e;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 3686736..8f2222a 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -1269,7 +1269,9 @@ element in the hash. Entries are returned in an apparently random order. The actual random order is subject to change in future versions of perl, but it is guaranteed to be in the same order as either the C or C -function would produce on the same (unmodified) hash. +function would produce on the same (unmodified) hash. Since Perl +5.8.1 the ordering is different even between different runs of Perl +for security reasons (see L). When the hash is entirely read, a null array is returned in list context (which when assigned produces a false (C<0>) value), and C in @@ -1642,7 +1644,7 @@ For example: fcntl($filehandle, F_GETFL, $packed_return_buffer) or die "can't fcntl F_GETFL: $!"; -You don't have to check for C on the return from C. +You don't have to check for C on the return from C. Like C, 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 @@ -2317,7 +2319,9 @@ Returns a list consisting of all the keys of the named hash. The keys are returned in an apparently random order. The actual random order is subject to change in future versions of perl, but it is guaranteed to be the same order as either the C or C -function produces (given that the hash has not been modified). +function produces (given that the hash has not been modified). Since +Perl 5.8.1 the ordering is different even between different runs of +Perl for security reasons (see L). As a side effect, calling keys() resets the HASH's internal iterator, @@ -2374,7 +2378,7 @@ same as the number actually killed). kill 9, @goners; If SIGNAL is zero, no signal is sent to the process. This is a -useful way to check that the process is alive and hasn't changed +useful way to check that a child process is alive and hasn't changed its UID. See L for notes on the portability of this construct. @@ -2382,7 +2386,9 @@ Unlike in the shell, if SIGNAL is negative, it kills process groups instead of processes. (On System V, a negative I number will also kill process groups, but that's not portable.) That means you usually want to use positive not negative signals. You may also -use a signal name in quotes. See L for details. +use a signal name in quotes. + +See L for more details. =item last LABEL @@ -4758,6 +4764,15 @@ inconsistent results (sometimes saying C<$x[1]> is less than C<$x[2]> and sometimes saying the opposite, for example) the results are not well-defined. +Because C<< <=> >> returns C when either operand is C +(not-a-number), and because C will trigger a fatal error unless the +result of a comparison is defined, when sorting with a comparison function +like C<< $a <=> $b >>, be careful about lists that might contain a C. +The following example takes advantage of the fact that C to +eliminate any Cs from the input. + + @result = sort { $a <=> $b } grep { $_ == $_ } @input; + =item splice ARRAY,OFFSET,LENGTH,LIST =item splice ARRAY,OFFSET,LENGTH @@ -4856,8 +4871,8 @@ The LIMIT parameter can be used to split a line partially ($login, $passwd, $remainder) = split(/:/, $_, 3); -When assigning to a list, if LIMIT is omitted, Perl supplies a LIMIT -one larger than the number of variables in the list, to avoid +When assigning to a list, if LIMIT is omitted, or zero, Perl supplies +a LIMIT one larger than the number of variables in the list, to avoid unnecessary work. For the list above LIMIT would have been 4 by default. In time critical applications it behooves you not to split into more fields than you really need. @@ -5656,7 +5671,7 @@ and C (start of the file, current position, end of the file) from the Fcntl module. Use of the constants is also more portable than relying on 0, 1, and 2. For example to define a "systell" function: - use Fnctl 'SEEK_CUR'; + use Fcntl 'SEEK_CUR'; sub systell { sysseek($_[0], 0, SEEK_CUR) } Returns the new position, or the undefined value on failure. A position @@ -5984,7 +5999,7 @@ string of octal digits. See also L, if all you have is a string. Undefines the value of EXPR, which must be an lvalue. Use only on a scalar value, an array (using C<@>), a hash (using C<%>), a subroutine -(using C<&>), or a typeglob (using <*>). (Saying C +(using C<&>), or a typeglob (using C<*>). (Saying C will probably not do what you expect on most predefined variables or DBM list values, so don't do that; see L.) Always returns the undefined value. You can omit the EXPR, in which case nothing is @@ -6227,7 +6242,9 @@ Returns a list consisting of all the values of the named hash. The values are returned in an apparently random order. The actual random order is subject to change in future versions of perl, but it is guaranteed to be the same order as either the C or C -function would produce on the same (unmodified) hash. +function would produce on the same (unmodified) hash. Since Perl +5.8.1 the ordering is different even between different runs of Perl +for security reasons (see L). As a side effect, calling values() resets the HASH's internal iterator, see L.