mkdir without arguments now defaults to $_
[p5sagit/p5-mst-13.2.git] / pod / perlfunc.pod
index a7eaece..81a42c2 100644 (file)
@@ -2687,10 +2687,13 @@ and you get list of anonymous hashes each with only 1 entry.
 
 =item mkdir FILENAME
 
+=item mkdir
+
 Creates the directory specified by FILENAME, with permissions
 specified by MASK (as modified by C<umask>).  If it succeeds it
 returns true, otherwise it returns false and sets C<$!> (errno).
-If omitted, MASK defaults to 0777.
+If omitted, MASK defaults to 0777. If omitted, FILENAME defaults
+to C<$_>.
 
 In general, it is better to create directories with permissive MASK,
 and let the user modify that with their C<umask>, than it is to supply
@@ -3008,7 +3011,7 @@ Examples:
        }
     }
 
-See L<perliol/> for detailed info on PerlIO.
+See L<perliol> for detailed info on PerlIO.
 
 You may also, in the Bourne shell tradition, specify an EXPR beginning
 with C<< '>&' >>, in which case the rest of the string is interpreted
@@ -3358,15 +3361,16 @@ of values, as follows:
     U  A Unicode character number.  Encodes to UTF-8 internally
        (or UTF-EBCDIC in EBCDIC platforms).
 
-    w  A BER compressed integer.  Its bytes represent an unsigned
-       integer in base 128, most significant digit first, with as
-        few digits as possible.  Bit eight (the high bit) is set
-        on each byte except the last.
+    w  A BER compressed integer (not an ASN.1 BER, see perlpacktut for
+       details).  Its bytes represent an unsigned integer in base 128,
+       most significant digit first, with as few digits as possible.  Bit
+       eight (the high bit) is set on each byte except the last.
 
     x  A null byte.
     X  Back up a byte.
-    @  Null fill to absolute position, counted from the start of
-        the innermost ()-group.
+    @  Null fill or truncate to absolute position, counted from the
+        start of the innermost ()-group.
+    .   Null fill or truncate to absolute position specified by value.
     (  Start of a ()-group.
 
 Some letters in the TEMPLATE may optionally be followed by one or
@@ -3380,6 +3384,10 @@ which the modifier is valid):
 
         nNvV       Treat integers as signed instead of unsigned.
 
+        @.         Specify position as byte offset in the internal
+                   representation of the packed string. Efficient but
+                   dangerous.
+
     >   sSiIlLqQ   Force big-endian byte-order on the type.
         jJfFdDpP   (The "big end" touches the construct.)
 
@@ -3398,12 +3406,13 @@ The following rules apply:
 
 Each letter may optionally be followed by a number giving a repeat
 count.  With all types except C<a>, C<A>, C<Z>, C<b>, C<B>, C<h>,
-C<H>, C<@>, C<x>, C<X> and C<P> the pack function will gobble up that
-many values from the LIST.  A C<*> for the repeat count means to use
-however many items are left, except for C<@>, C<x>, C<X>, where it is
-equivalent to C<0>, and C<u>, where it is equivalent to 1 (or 45, what
-is the same).  A numeric repeat count may optionally be enclosed in
-brackets, as in C<pack 'C[80]', @arr>.
+C<H>, C<@>, C<.>, C<x>, C<X> and C<P> the pack function will gobble up
+that many values from the LIST.  A C<*> for the repeat count means to
+use however many items are left, except for C<@>, C<x>, C<X>, where it
+is equivalent to C<0>, for <.> where it means relative to string start
+and C<u>, where it is equivalent to 1 (or 45, which is the same).
+A numeric repeat count may optionally be enclosed in brackets, as in
+C<pack 'C[80]', @arr>.
 
 One can replace the numeric repeat count by a template enclosed in brackets;
 then the packed length of this template in bytes is used as a count.
@@ -3417,6 +3426,17 @@ When used with C<Z>, C<*> results in the addition of a trailing null
 byte (so the packed result will be one longer than the byte C<length>
 of the item).
 
+When used with C<@>, the repeat count represents an offset from the start
+of the innermost () group.
+
+When used with C<.>, the repeat count is used to determine the starting
+position from where the value offset is calculated. If the repeat count
+is 0, it's relative to the current position. If the repeat count is C<*>,
+the offset is relative to the start of the packed string. And if its an
+integer C<n> the offset is relative to the start of the n-th innermost
+() group (or the start of the string if C<n> is bigger then the group
+level).
+
 The repeat count for C<u> is interpreted as the maximal number of bytes
 to encode per line of output, with 0, 1 and 2 replaced by 45. The repeat 
 count should not be more than 65.
@@ -3689,7 +3709,6 @@ C<@> starts again at 0. Therefore, the result of
 
 is the string "\0a\0\0bc".
 
-
 =item *
 
 C<x> and C<X> accept C<!> modifier.  In this case they act as
@@ -3780,6 +3799,8 @@ Examples:
     $bar = pack('s@4l', 12, 34);
     # short 12, zero fill to position 4, long 34
     # $foo eq $bar
+    $baz = pack('s.l', 12, 4, 34);
+    # short 12, zero fill to position 4, long 34
 
     $foo = pack('nN', 42, 4711);
     # pack big-endian 16- and 32-bit unsigned integers
@@ -4282,7 +4303,7 @@ a bareword argument, there is a little extra functionality going on
 behind the scenes.  Before C<require> looks for a "F<.pm>" extension,
 it will first look for a filename with a "F<.pmc>" extension.  A file
 with this extension is assumed to be Perl bytecode generated by
-L<B::Bytecode|B::Bytecode>.  If this file is found, and it's modification
+L<B::Bytecode|B::Bytecode>.  If this file is found, and its modification
 time is newer than a coinciding "F<.pm>" non-compiled file, it will be
 loaded in place of that non-compiled file ending in a "F<.pm>" extension.
 
@@ -4585,6 +4606,14 @@ Note that whether C<select> gets restarted after signals (say, SIGALRM)
 is implementation-dependent.  See also L<perlport> for notes on the
 portability of C<select>.
 
+On error, C<select> returns C<undef> and sets C<$!>.
+
+Note: on some Unixes, the select(2) system call may report a socket file
+descriptor as "ready for reading", when actually no data is available,
+thus a subsequent read blocks. It can be avoided using always the
+O_NONBLOCK flag on the socket. See select(2) and fcntl(2) for further
+details.
+
 B<WARNING>: One should not attempt to mix buffered I/O (like C<read>
 or <FH>) with C<select>, except as permitted by POSIX, and even
 then only on POSIX systems.  You have to use C<sysread> instead.