X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlfunc.pod;h=db90b86879c33faf931691ea0e06b949f66c1b3a;hb=91331b4fc62e0ad9094741aa6359fb89e2fc5554;hp=fd724a1704d32d59239e7d4cc134124849451735;hpb=194e7b382bb28b53644a2ea16df2fe5fda9ad386;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index fd724a1..db90b86 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -612,6 +612,8 @@ If VARIABLE is omitted, it chomps C<$_>. Example: # ... } +If VARIABLE is a hash, it chomps the hash's values, but not its keys. + You can actually chomp anything that's an lvalue, including an assignment: chomp($cwd = `pwd`); @@ -638,6 +640,8 @@ Example: #... } +If VARIABLE is a hash, it chops the hash's values, but not its keys. + You can actually chop anything that's an lvalue, including an assignment: chop($cwd = `pwd`); @@ -2819,7 +2823,7 @@ otherwise it's necessary to protect any leading and trailing whitespace: $file =~ s#^(\s)#./$1#; open(FOO, "< $file\0"); -(this may not work on some bizzare filesystems). One should +(this may not work on some bizarre filesystems). One should conscientiously choose between the I and 3-arguments form of open(): @@ -3153,13 +3157,13 @@ because they obey the native byteorder and endianness. For example a 4-byte integer 0x12345678 (305419896 decimal) be ordered natively (arranged in and handled by the CPU registers) into bytes as - 0x12 0x34 0x56 0x78 # little-endian - 0x78 0x56 0x34 0x12 # big-endian + 0x12 0x34 0x56 0x78 # big-endian + 0x78 0x56 0x34 0x12 # little-endian -Basically, the Intel, Alpha, and VAX CPUs are little-endian, while -everybody else, for example Motorola m68k/88k, PPC, Sparc, HP PA, -Power, and Cray are big-endian. MIPS can be either: Digital used it -in little-endian mode; SGI uses it in big-endian mode. +Basically, the Intel and VAX CPUs are little-endian, while everybody +else, for example Motorola m68k/88k, PPC, Sparc, HP PA, Power, and +Cray are big-endian. Alpha and MIPS can be either: Digital/Compaq +used/uses them in little-endian mode; SGI/Cray uses them in big-endian mode. The names `big-endian' and `little-endian' are comic references to the classic "Gulliver's Travels" (via the paper "On Holy Wars and a @@ -4101,7 +4105,7 @@ C interface to access setitimer(2) if your system supports it, or else see L above. The Time::HiRes module from CPAN may also help. -See also the POSIX module's C function. +See also the POSIX module's C function. =item socket SOCKET,DOMAIN,TYPE,PROTOCOL @@ -4452,9 +4456,11 @@ permits these unnecessary but widely-supported conversions: %O a synonym for %lo %F a synonym for %f -Conversions to scientific notation by C<%e>, C<%E>, C<%g> and C<%G> -always have a two-digit exponent unless the modulus of the exponent is -greater than 99. +Note that the number of exponent digits in the scientific notation by +C<%e>, C<%E>, C<%g> and C<%G> for numbers with the modulus of the +exponent less than 100 is system-dependent: it may be three or less +(zero-padded as necessary). In other words, 1.23 times ten to the +99th may be either "1.23e99" or "1.23e099". Perl permits the following universally-known flags between the C<%> and the conversion letter: @@ -5085,6 +5091,7 @@ A class implementing a hash should have the following methods: FIRSTKEY this NEXTKEY this, lastkey DESTROY this + UNTIE this A class implementing an ordinary array should have the following methods: @@ -5101,6 +5108,7 @@ A class implementing an ordinary array should have the following methods: SPLICE this, offset, length, LIST EXTEND this, count DESTROY this + UNTIE this A class implementing a file handle should have the following methods: @@ -5111,8 +5119,15 @@ A class implementing a file handle should have the following methods: WRITE this, scalar, length, offset PRINT this, LIST PRINTF this, format, LIST + BINMODE this + EOF this + FILENO this + SEEK this, position, whence + TELL this + OPEN this, mode, LIST CLOSE this DESTROY this + UNTIE this A class implementing a scalar should have the following methods: @@ -5120,6 +5135,7 @@ A class implementing a scalar should have the following methods: FETCH this, STORE this, value DESTROY this + UNTIE this Not all methods indicated above need be implemented. See L, L, L, L, and L. @@ -5480,7 +5496,7 @@ 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 -pack()/unpack() with big-endian formats C/C (and analoguously +pack()/unpack() with big-endian formats C/C (and analogously for BITS==64). See L<"pack"> for details. If bits is 4 or less, the string is broken into bytes, then the bits @@ -5495,9 +5511,18 @@ to give the expression the correct precedence as in vec($image, $max_x * $x + $y, 8) = 3; -If the selected element is off the end of the string, the value 0 is -returned. If an element off the end of the string is written to, -Perl will first extend the string with sufficiently many zero bytes. +If the selected element is outside the string, the value 0 is returned. +If an element off the end of the string is written to, Perl will first +extend the string with sufficiently many zero bytes. It is an error +to try to write off the beginning of the string (i.e. negative OFFSET). + +The string should not contain any character with the value > 255 (which +can only happen if you're using UTF8 encoding). If it does, it will be +treated as something which is not UTF8 encoded. When the C was +assigned to, other parts of your program will also no longer consider the +string to be UTF8 encoded. In other words, if you do have such characters +in your string, vec() will operate on the actual byte string, and not the +conceptual character string. Strings created with C can also be manipulated with the logical operators C<|>, C<&>, C<^>, and C<~>. These operators will assume a bit