Scalar::Util - A selection of general-utility scalar subroutines

NAME SYNOPSIS DESCRIPTION FUNCTIONS FOR REFERENCESblessed refaddr reftype weaken unweaken isweak OTHER FUNCTIONSdualvar isdual isvstring looks_like_number openhandle readonly set_prototype tainted DIAGNOSTICS KNOWN BUGS SEE ALSO COPYRIGHT NAME Scalar::Util - A selection of general-utility scalar subroutines SYNOPSIS use Scalar::Util qw(blessed dualvar isdual readonly refaddr reftype tainted weaken isweak isvstring looks_like_number set_prototype);

scalar

scalar EXPR Forces EXPR to be interpreted in scalar context and returns the value of EXPR. @counts = ( scalar @a, scalar @b, scalar @c ); There is no equivalent operator to force an expression to be interpolated in list context because in practice, this is never needed. If you really wanted to do so, however, you could use the construction @{[ (some expression) ]} , but usually a simple (some expression) suffices. Because scalar is a unary operator, if you accidentally use a parenthesized list

Safe - Compile and execute code in restricted compartments

NAME SYNOPSIS DESCRIPTION WARNING METHODSpermit (OP, ...) permit_only (OP, ...) deny (OP, ...) deny_only (OP, ...) trap (OP, ...), untrap (OP, ...) share (NAME, ...) share_from (PACKAGE, ARRAYREF) varglob (VARNAME) reval (STRING, STRICT) rdo (FILENAME) root (NAMESPACE) mask (MASK) wrap_code_ref (CODEREF) wrap_code_refs_within (...) RISKS AUTHOR NAME Safe - Compile and execute code in restricted compartments SYNOPSIS use Safe; $compartment = new Safe; $compartment->permit(qw(time sort :

say

say FILEHANDLE LIST say FILEHANDLE say LIST say Just like print, but implicitly appends a newline. say LIST is simply an abbreviation for { local $\ = "\n"; print LIST } . To use FILEHANDLE without a LIST to print the contents of $_ to it, you must use a real filehandle like FH , not an indirect one like $fh . This keyword is available only when the "say" feature is enabled, or when prefixed with CORE:: ; see feature. Alternately, include a use v5.10 or later to the current scope.

rewinddir

rewinddir DIRHANDLE Sets the current position to the beginning of the directory for the readdir routine on DIRHANDLE. Portability issues: rewinddir in perlport.

rmdir

rmdir FILENAME rmdir Deletes the directory specified by FILENAME if that directory is empty. If it succeeds it returns true; otherwise it returns false and sets $! (errno). If FILENAME is omitted, uses $_ . To remove a directory tree recursively (rm -rf on Unix) look at the rmtree function of the File::Path module.

s

s/// The substitution operator. See Regexp Quote-Like Operators in perlop.

return

return EXPR return Returns from a subroutine, eval, or do FILE with the value given in EXPR. Evaluation of EXPR may be in list, scalar, or void context, depending on how the return value will be used, and the context may vary from one execution to the next (see wantarray). If no EXPR is given, returns an empty list in list context, the undefined value in scalar context, and (of course) nothing at all in void context. (In the absence of an explicit return, a subroutine, eval, or do FILE automati

reverse

reverse LIST In list context, returns a list value consisting of the elements of LIST in the opposite order. In scalar context, concatenates the elements of LIST and returns a string value with all characters in the opposite order. print join(", ", reverse "world", "Hello"); # Hello, world print scalar reverse "dlrow ,", "olleH"; # Hello, world Used without arguments in scalar context, reverse() reverses $_ . $_ = "dlrow ,olleH"; print reverse; # No output, list con

rindex

rindex STR,SUBSTR,POSITION rindex STR,SUBSTR Works just like index() except that it returns the position of the last occurrence of SUBSTR in STR. If POSITION is specified, returns the last occurrence beginning at or before that position.