X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlfunc.pod;h=2f9a85c8f6bb83e36a32497ea36ac04aab0b98b8;hb=98af1e142028dcf116f32636ea54f4c3e9494651;hp=3e107c93faf55d47e07d699c09e4b6bab29a7693;hpb=9f5e10ca92116e50ba77fee2d7f4b85b0cfe80e9;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 3e107c9..2f9a85c 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -492,8 +492,8 @@ function, or use the familiar relation: sub tan { sin($_[0]) / cos($_[0]) } -Note that atan2(0, 0) is not well-defined, however the Perl -implmentation returns C<0> for this value. +The return value for C is implementation-defined; consult +your atan2(3) manpage for more information. =item bind SOCKET,NAME X @@ -1562,6 +1562,10 @@ determining whether a particular feature (such as C or C) is implemented. It is also Perl's exception trapping mechanism, where the die operator is used to raise exceptions. +If you want to trap errors when loading an XS module, some problems with +the binary interface (such as Perl version skew) may be fatal even with +C unless C<$ENV{PERL_DL_NONLAZY}> is set. See L. + If the code to be executed doesn't vary, you may use the eval-BLOCK form to trap run-time errors without incurring the penalty of recompiling each time. The error, if any, is still returned in C<$@>. @@ -1731,8 +1735,7 @@ X X Given an expression that specifies a hash element or array element, returns true if the specified element in the hash or array has ever -been initialized, even if the corresponding value is undefined. The -element is not autovivified if it doesn't exist. +been initialized, even if the corresponding value is undefined. print "Exists\n" if exists $hash{$key}; print "Defined\n" if defined $hash{$key}; @@ -2344,8 +2347,14 @@ implementing the C<< <*.c> >> operator, but you can use it directly. If EXPR is omitted, C<$_> is used. The C<< <*.c> >> operator is discussed in more detail in L. +Note that C will split its arguments on whitespace, treating +each segment as separate pattern. As such, C would +match all files with a F<.c> or F<.h> extension. The expression +C would match all files in the current working directory. + Beginning with v5.6.0, this operator is implemented using the standard -C extension. See L for details. +C extension. See L for details, including +C which does not treat whitespace as a pattern separator. =item gmtime EXPR X X X @@ -4211,13 +4220,15 @@ the completed C. =item qq/STRING/ -=item qr/STRING/ - =item qx/STRING/ =item qw/STRING/ -Generalized quotes. See L. +Generalized quotes. See L. + +=item qr/STRING/ + +Regexp-like quote. See L. =item quotemeta EXPR X X @@ -4716,13 +4727,16 @@ of LIST in the opposite order. In scalar context, concatenates the elements of LIST and returns a string value with all characters in the opposite order. - print reverse <>; # line tac, last line first + print join(", ", reverse "world", "Hello"); # Hello, world - undef $/; # for efficiency of <> - print scalar reverse <>; # character tac, last line tsrif + print scalar reverse "dlrow ,", "olleH"; # Hello, world Used without arguments in scalar context, reverse() reverses C<$_>. + $_ = "dlrow ,olleH"; + print reverse; # No output, list context + print scalar reverse; # Hello, world + 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 @@ -5114,6 +5128,10 @@ It's also a more insistent form of close because it also disables the file descriptor in any forked copies in other processes. +Returns C<1> for success. In the case of error, returns C if +the first argument is not a valid filehandle, or returns C<0> and sets +C<$!> for any other failure. + =item sin EXPR X X X X @@ -5133,10 +5151,18 @@ X X =item sleep Causes the script to sleep for EXPR seconds, or forever if no EXPR. +Returns the number of seconds actually slept. + May be interrupted if the process receives a signal such as C. -Returns the number of seconds actually slept. You probably cannot -mix C and C calls, because C is often implemented -using C. + + eval { + local $SIG{ALARM} = sub { die "Alarm!\n" }; + sleep; + }; + die $@ unless $@ eq "Alarm!\n"; + +You probably cannot mix C and C calls, because C +is often implemented using C. On some older systems, it may sleep up to a full second less than what you requested, depending on how it counts seconds. Most modern systems @@ -5441,7 +5467,7 @@ a null pattern C, which is just one member of the set of patterns matching a null string) will split the value of EXPR into separate characters at each point it matches that way. For example: - print join(':', split(/ */, 'hi there')); + print join(':', split(/ */, 'hi there')), "\n"; produces the output 'h:i:t:h:e:r:e'. @@ -5450,7 +5476,7 @@ matches only the null string, and is not be confused with the regular use of C to mean "the last successful pattern match". So, for C, the following: - print join(':', split(//, 'hi there')); + print join(':', split(//, 'hi there')), "\n"; produces the output 'h:i: :t:h:e:r:e'. @@ -5465,8 +5491,8 @@ hand, are produced when there is a match at the end of the string (and when LIMIT is given and is not 0), regardless of the length of the match. For example: - print join(':', split(//, 'hi there!', -1)); - print join(':', split(/\W/, 'hi there!', -1)); + print join(':', split(//, 'hi there!', -1)), "\n"; + print join(':', split(/\W/, 'hi there!', -1)), "\n"; produce the output 'h:i: :t:h:e:r:e:!:' and 'hi:there:', respectively, both with an empty trailing field.