diff options
Diffstat (limited to 'pod/perlfunc.pod')
-rw-r--r-- | pod/perlfunc.pod | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index cc9fa00238..4bf1fdabb1 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -2156,8 +2156,11 @@ types gobble just one value, but pack it as a string of length count, padding with nulls or spaces as necessary. (When unpacking, "A" strips trailing spaces and nulls, but "a" does not.) Likewise, the "b" and "B" fields pack a string that many bits long. The "h" and "H" fields pack a -string that many nybbles long. The "P" packs a pointer to a structure of -the size indicated by the length. Real numbers (floats and doubles) are +string that many nybbles long. The "p" type packs a pointer to a null- +terminated string. You are responsible for ensuring the string is not a +temporary value (which can potentially get deallocated before you get +around to using the packed result). The "P" packs a pointer to a structure +of the size indicated by the length. Real numbers (floats and doubles) are in the native machine format only; due to the multiplicity of floating formats around, and the lack of a standard "network" representation, no facility for interchange has been made. This means that packed floating @@ -2377,6 +2380,16 @@ chdir() there, it would have been testing the wrong file. @dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR); closedir DIR; +=item readline EXPR + +Reads from the file handle EXPR. In scalar context, a single line +is read and returned. In list context, reads until end-of-file is +reached and returns a list of lines (however you've defined lines +with $/ or $INPUT_RECORD_SEPARATOR). +This is the internal function implementing the C<E<lt>EXPRE<gt>> +operator, but you can use it directly. The C<E<lt>EXPRE<gt>> +operator is discussed in more detail in L<perlop/"I/O Operators">. + =item readlink EXPR =item readlink @@ -2386,6 +2399,17 @@ implemented. If not, gives a fatal error. If there is some system error, returns the undefined value and sets C<$!> (errno). If EXPR is omitted, uses $_. +=item readpipe EXPR + +EXPR is interpolated and then executed as a system command. +The collected standard output of the command is returned. +In scalar context, it comes back as a single (potentially +multi-line) string. In list context, returns a list of lines +(however you've defined lines with $/ or $INPUT_RECORD_SEPARATOR). +This is the internal function implementing the C<qx/EXPR/> +operator, but you can use it directly. The C<qx/EXPR/> +operator is discussed in more detail in L<perlop/"I/O Operators">. + =item recv SOCKET,SCALAR,LEN,FLAGS Receives a message on a socket. Attempts to receive LENGTH bytes of @@ -3342,11 +3366,15 @@ L<perlref> for details. Extracts a substring out of EXPR and returns it. First character is at offset 0, or whatever you've set C<$[> to (but don't do that). -If OFFSET is negative, starts +If OFFSET is negative (or more precisely, less than C<$[>), starts that far from the end of the string. If LEN is omitted, returns everything to the end of the string. If LEN is negative, leaves that many characters off the end of the string. +If you specify a substring which is partly outside the string, the part +within the string is returned. If the substring is totally outside +the string a warning is produced. + You can use the substr() function as an lvalue, in which case EXPR must be an lvalue. If you assign something shorter than LEN, the string will shrink, and if you assign |