X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlfunc.pod;h=174ff60f27eecf1de1601a9087d02cd3a32d4c40;hb=bbd5c0f5ad81733b079008f34cd05cd9aef7d917;hp=7aaeaf3d3bdd69c8e0a4ead6f103eb1c026f2fd5;hpb=b76cc8ba45957a82b545cf2a7b818233e6c0d507;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 7aaeaf3..174ff60 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -69,7 +69,7 @@ last value in the list. Some operators return a count of successful operations. In general, they do what you want, unless you want consistency. -An named array in scalar context is quite different from what would at +A named array in scalar context is quite different from what would at first glance appear to be a list in scalar context. You can't get a list like C<(1,2,3)> into being in scalar context, because the compiler knows the context at compile time. It would generate the scalar comma operator @@ -172,7 +172,7 @@ C, C C, C, C, C, C, C, C, C, C, C, C, -C, C +C, C, C =item System V interprocess communication functions @@ -234,8 +234,9 @@ C, C, C, C, C, C above. The Time::HiRes module from CPAN -may also help. +it, or else see L above. The Time::HiRes module (from CPAN, +and starting from Perl 5.8 part of the standard distribution) may also +help. See also the POSIX module's C function. +=item sockatmark SOCKET + +Returns true if the socket is positioned at the out-of-band mark +(also known as the urgent data mark), false otherwise. Use right +after reading from the socket. + +Not available directly, one has to import the function from +the IO::Socket extension + + use IO::Socket 'sockatmark'; + +Even this doesn't guarantee that sockatmark() really is available, +though, because sockatmark() is a relatively recent addition to +the family of socket functions. If it is unavailable, attempt to +use it will fail + + IO::Socket::atmark not implemented on this architecture ... + +See also L. + =item socket SOCKET,DOMAIN,TYPE,PROTOCOL Opens a socket of the specified kind and attaches it to filehandle @@ -4222,6 +4382,12 @@ loop control operators described in L or with C. When C is in effect, C sorts LIST according to the current collation locale. See L. +Perl does B guarantee that sort is stable. (A I sort +preserves the input order of elements that compare equal.) 5.7 and +5.8 happen to use a stable mergesort, but 5.6 and earlier used quicksort, +which is not stable. Do not assume that future perls will continue to +use a stable sort. + Examples: # sort lexically @@ -4378,11 +4544,15 @@ splits on whitespace (after skipping any leading whitespace). Anything matching PATTERN is taken to be a delimiter separating the fields. (Note that the delimiter may be longer than one character.) -If LIMIT is specified and positive, splits into no more than that -many fields (though it may split into fewer). If LIMIT is unspecified -or zero, trailing null fields are stripped (which potential users -of C would do well to remember). If LIMIT is negative, it is -treated as if an arbitrarily large LIMIT had been specified. +If LIMIT is specified and positive, it represents the maximum number +of fields the EXPR will be split into, though the actual number of +fields returned depends on the number of times PATTERN matches within +EXPR. If LIMIT is unspecified or zero, trailing null fields are +stripped (which potential users of C would do well to remember). +If LIMIT is negative, it is treated as if an arbitrarily large LIMIT +had been specified. Note that splitting an EXPR that evaluates to the +empty string always returns the empty list, regardless of the LIMIT +specified. A pattern matching the null string (not to be confused with a null pattern C, which is just one member of the set of patterns @@ -4393,6 +4563,10 @@ characters at each point it matches that way. For example: produces the output 'h:i:t:h:e:r:e'. +Using the empty pattern C specifically matches the null string, and is +not be confused with the use of C to mean "the last successful pattern +match". + Empty leading (or trailing) fields are produced when there positive width matches at the beginning (or end) of the string; a zero-width match at the beginning (or end) of the string does not produce an empty field. For @@ -4452,6 +4626,11 @@ Example: #... } +As with regular pattern matching, any capturing parentheses that are not +matched in a C will be set to C when returned: + + @fields = split /(A)|B/, "1A2B3"; + # @fields is (1, 'A', 2, undef, 3) =item sprintf FORMAT, LIST @@ -4630,19 +4809,42 @@ loaded the standard Math::Complex module. =item srand -Sets the random number seed for the C operator. If EXPR is -omitted, uses a semi-random value supplied by the kernel (if it supports -the F device) or based on the current time and process -ID, among other things. In versions of Perl prior to 5.004 the default -seed was just the current C