readline

readline EXPR readline Reads from the filehandle whose typeglob is contained in EXPR (or from *ARGV if EXPR is not provided). In scalar context, each call reads and returns the next line until end-of-file is reached, whereupon the subsequent call returns undef. In list context, reads until end-of-file is reached and returns a list of lines. Note that the notion of "line" used here is whatever you may have defined with $/ or $INPUT_RECORD_SEPARATOR ). See $/ in perlvar. When $/ is set to undef,

readdir

readdir DIRHANDLE Returns the next directory entry for a directory opened by opendir. If used in list context, returns all the rest of the entries in the directory. If there are no more entries, returns the undefined value in scalar context and the empty list in list context. If you're planning to filetest the return values out of a readdir, you'd better prepend the directory in question. Otherwise, because we didn't chdir there, it would have been testing the wrong file. opendir(my $dh, $some_

read

read FILEHANDLE,SCALAR,LENGTH,OFFSET read FILEHANDLE,SCALAR,LENGTH Attempts to read LENGTH characters of data into variable SCALAR from the specified FILEHANDLE. Returns the number of characters actually read, 0 at end of file, or undef if there was an error (in the latter case $! is also set). SCALAR will be grown or shrunk so that the last character actually read is the last character of the scalar after the read. An OFFSET may be specified to place the read data at some place in the string o

re - Perl pragma to alter regular expression behaviour

NAME SYNOPSIS DESCRIPTION'taint' mode 'eval' mode 'strict' mode '/flags' mode 'debug' mode 'Debug' mode Exportable Functions SEE ALSO NAME re - Perl pragma to alter regular expression behaviour SYNOPSIS use re 'taint'; ($x) = ($^X =~ /^(.*)$/s); # $x is tainted here $pat = '(?{ $foo = 1 })'; use re 'eval'; /foo${pat}bar/; # won't fail (when not under -T # switch) { no re 'taint'; # the default ($x) = ($^X =~ /^(.*)$/s); # $x

Range Operators

Range Operators Binary ".." is the range operator, which is really two different operators depending on the context. In list context, it returns a list of values counting (up by ones) from the left value to the right value. If the left value is greater than the right value then it returns the empty list. The range operator is useful for writing foreach (1..10) loops and for doing slice operations on arrays. In the current implementation, no temporary array is created when the range operator is

rand

rand EXPR rand Returns a random fractional number greater than or equal to 0 and less than the value of EXPR. (EXPR should be positive.) If EXPR is omitted, the value 1 is used. Currently EXPR with the value 0 is also special-cased as 1 (this was undocumented before Perl 5.8.0 and is subject to change in future versions of Perl). Automatically calls srand unless srand has already been called. See also srand. Apply int() to the value returned by rand() if you want random integers instead of rand

qx

qx/STRING/ Generalized quotes. See Quote-Like Operators in perlop.

qw

qw/STRING/

quotemeta

quotemeta EXPR quotemeta Returns the value of EXPR with all the ASCII non-"word" characters backslashed. (That is, all ASCII characters not matching /[A-Za-z_0-9]/ will be preceded by a backslash in the returned string, regardless of any locale settings.) This is the internal function implementing the \Q escape in double-quoted strings. (See below for the behavior on non-ASCII code points.) If EXPR is omitted, uses $_ . quotemeta (and \Q ... \E ) are useful when interpolating strings into regul

Quote-Like Operators

Quote-Like Operators q/STRING/ 'STRING' A single-quoted, literal string. A backslash represents a backslash unless followed by the delimiter or another backslash, in which case the delimiter or backslash is interpolated. $foo = q!I said, "You said, 'She said it.'"!; $bar = q('This is it.'); $baz = '\n'; # a two-character string qq/STRING/ "STRING" A double-quoted, interpolated string. $_ .= qq (*** The previous line contains the naughty word "$1".\n) if /\b(tcl|java|python