X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlfunc.pod;h=fcd6f57ef10564126e1d1275649d77b61e7fd818;hb=5269aecde866056a77e32c937c7c3182bb599487;hp=0d620d90dc9fc95fbd397b580130faa24888ca3c;hpb=cc1852e86ffe691532acd06056adaae78b720a30;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 0d620d9..fcd6f57 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -96,9 +96,8 @@ than one place. =item Functions for SCALARs or strings C, C, C, C, C, C, C, C, -C, C, C, C, C, C, C, -C, C, C, C, C, C, C, -C +C, C, C, C, C, C, C, +C, C, C, C, C, C, C =item Regular expressions and pattern matching @@ -173,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 @@ -201,7 +200,7 @@ C, C, C, -L, and L.) =item sprintf FORMAT, LIST @@ -4499,7 +4588,7 @@ In addition, Perl permits the following widely-supported conversions: %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 + into the next variable in the parameter list Finally, for backward (and we do mean "backward") compatibility, Perl permits these unnecessary but widely-supported conversions: @@ -4714,7 +4803,7 @@ last stat or filetest are returned. Example: 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"> +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]; @@ -4728,7 +4817,7 @@ 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", + printf "File is %s, size is %s, perm %04o, mtime %s\n", $filename, $sb->size, $sb->mode & 07777, scalar localtime $sb->mtime; @@ -4775,7 +4864,7 @@ and the S_IF* functions are and the setuid/setgid/sticky bits S_IFMT($mode) the part of $mode containing the file type - which can be bit-anded with e.g. S_IFREG + which can be bit-anded with e.g. S_IFREG or with the following functions # The operators -f, -d, -l, -b, -c, -p, and -s. @@ -4940,7 +5029,7 @@ check the value of C<$!> if syscall returns C<-1>. There's a problem with C: it returns the file number of the read end of the pipe it creates. There is no way -to retrieve the file number of the other end. You can avoid this +to retrieve the file number of the other end. You can avoid this problem by using C instead. =item sysopen FILEHANDLE,FILENAME,MODE @@ -5117,7 +5206,7 @@ case the SCALAR is empty you can use OFFSET but only zero offset. Returns the current position for FILEHANDLE, or -1 on error. FILEHANDLE may be an expression whose value gives the name of the actual filehandle. -If FILEHANDLE is omitted, assumes the file last read. +If FILEHANDLE is omitted, assumes the file last read. The return value of tell() for the standard streams like the STDIN depends on the operating system: it may return -1 or something else. @@ -5248,6 +5337,8 @@ seconds, for this process and the children of this process. ($user,$system,$cuser,$csystem) = times; +In scalar context, C returns C<$user>. + =item tr/// The transliteration operator. Same as C. See L. @@ -5415,7 +5506,7 @@ not known to be valid is likely to have disastrous consequences. If the repeat count of a field is larger than what the remainder of the input string allows, repeat count is decreased. If the input string -is longer than one described by the TEMPLATE, the rest is ignored. +is longer than one described by the TEMPLATE, the rest is ignored. See L for more examples and notes. @@ -5429,7 +5520,7 @@ Does the opposite of a C. Or the opposite of a C, depending on how you look at it. Prepends list to the front of the array, and returns the new number of elements in the array. - unshift(ARGV, '-e') unless $ARGV[0] =~ /^-/; + unshift(@ARGV, '-e') unless $ARGV[0] =~ /^-/; Note the LIST is prepended whole, not one element at a time, so the prepended elements stay in the same order. Use C to do the @@ -5493,7 +5584,7 @@ If the VERSION argument is present between Module and LIST, then the C will call the VERSION method in class Module with the given version as an argument. The default VERSION method, inherited from the UNIVERSAL class, croaks if the given version is larger than the -value of the variable C<$Module::VERSION>. +value of the variable C<$Module::VERSION>. Again, there is a distinction between omitting LIST (C called with no arguments) and an explicit empty LIST C<()> (C not @@ -5524,7 +5615,7 @@ by C, i.e., it calls C instead of C. If no C method can be found the call fails with a fatal error. -See L for a list of standard modules and pragmas. See L +See L for a list of standard modules and pragmas. See L for the C<-M> and C<-m> command-line options to perl that give C functionality from the command-line. @@ -5541,6 +5632,13 @@ command if the files already exist: $now = time; utime $now, $now, @ARGV; +If the first two elements of the list are C, then the utime(2) +function in the C library will be called with a null second argument. +On most systems, this will set the file's access and modification +times to the current time. (i.e. equivalent to the example above.) + + utime undef, undef, @ARGV; + =item values HASH Returns a list consisting of all the values of the named hash. (In a @@ -5568,7 +5666,7 @@ that are reserved for each element in the bit vector. This must be a power of two from 1 to 32 (or 64, if your platform supports that). -If BITS is 8, "elements" coincide with bytes of the input string. +If BITS is 8, "elements" coincide with bytes of the input string. If BITS is 16 or more, bytes of the input string are grouped into chunks of size BITS/8, and each group is converted to a number as with @@ -5639,7 +5737,7 @@ Here is an example to illustrate how the bits actually fall in place: #!/usr/bin/perl -wl print <<'EOT'; - 0 1 2 3 + 0 1 2 3 unpack("V",$_) 01234567890123456789012345678901 ------------------------------------------------------------------ EOT @@ -5667,7 +5765,7 @@ Here is an example to illustrate how the bits actually fall in place: Regardless of the machine architecture on which it is run, the above example should print the following table: - 0 1 2 3 + 0 1 2 3 unpack("V",$_) 01234567890123456789012345678901 ------------------------------------------------------------------ vec($_, 0, 1) = 1 == 1 10000000000000000000000000000000 @@ -5816,7 +5914,7 @@ The status is returned in C<$?>. If you say use POSIX ":sys_wait_h"; #... - do { + do { $kid = waitpid(-1,&WNOHANG); } until $kid == -1;