Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Built-in Functions

pperl PP runtime built-in functions extracted from the Rust implementation source.

Array Functions

  • delete — Removes the specified element(s) from a hash or array.
  • each — Returns the next key-value pair from a hash’s internal iterator.
  • exists — Tests whether a hash key or array index is present in the container.
  • keys — Returns all keys of a hash, or the number of keys in scalar context.
  • pop — Removes and returns the last element of an array.
  • push — Appends one or more values to the end of an array, growing it as needed.
  • shift — Removes and returns the first element of an array, shifting all
  • sort — Sorts a list of values and returns them in sorted order.
  • splice — Removes and/or replaces elements in an array, returning the removed
  • unshift — Prepends one or more values to the beginning of an array.
  • values — Returns all values of a hash, or the number of values in scalar context.

File Functions

  • chdir — Changes the process’s current working directory.
  • chmod — Changes file permissions on one or more files.
  • chown — Changes the owner and group of one or more files.
  • closedir — Closes a directory handle, releasing its resources.
  • glob — Expands shell-style filename patterns into matching pathnames.
  • link — Creates a hard link to an existing file.
  • lstat — Returns file metadata without following symbolic links.
  • mkdir — Creates a new directory with the specified permissions.
  • opendir — Opens a directory for reading via a directory handle.
  • readdir — Reads entries from an open directory handle.
  • readlink — Returns the target of a symbolic link.
  • rename — Renames or moves a file.
  • rewinddir — Resets the position of a directory handle back to the beginning.
  • rmdir — Removes an empty directory.
  • stat — Returns file metadata as a 13-element list.
  • symlink — Creates a symbolic (soft) link.
  • umask — Gets or sets the process file-creation permission mask.
  • unlink — Deletes one or more files from the filesystem.
  • utime — Sets the access and modification timestamps of one or more files.

Formatting

  • sprintf — Formats a string according to a printf-style format specification.

Hash Functions

  • delete — Removes the specified element(s) from a hash or array.
  • each — Returns the next key-value pair from a hash’s internal iterator.
  • exists — Tests whether a hash key or array index is present in the container.
  • keys — Returns all keys of a hash, or the number of keys in scalar context.
  • values — Returns all values of a hash, or the number of values in scalar context.

I/O Functions

  • binmode — Sets the I/O discipline (encoding layer) for a filehandle.
  • close — Closes a filehandle, flushing any buffered output.
  • eof — Tests whether the next read on a filehandle will return end-of-file.
  • fileno — Returns the underlying OS file descriptor for a Perl filehandle.
  • getc — Reads a single character from a filehandle.
  • open — Opens a file, pipe, or duplicates a file descriptor, associating
  • pipe — Creates a unidirectional pipe pair (read end + write end).
  • print — Outputs a list of values to a filehandle.
  • printf — Formats and prints a list of values to a filehandle using a format string.
  • read — Reads a fixed number of bytes from a filehandle into a scalar buffer.
  • readline — PP function for readline
  • say — Like print, but automatically appends a newline after the output.
  • seek — Sets the read/write position in a filehandle.
  • select — Sets the default output filehandle or performs I/O multiplexing.
  • sysopen — Opens a file using POSIX open(2) flags for precise mode control.
  • sysread — Performs an unbuffered read directly from the OS file descriptor.
  • syswrite — Performs an unbuffered write directly to the OS file descriptor.
  • tell — Returns the current byte position in a filehandle.
  • truncate — Truncates a file to a specified length.

Numeric Functions

  • rand — Returns a pseudo-random floating-point number.
  • srand — Seeds the pseudo-random number generator used by rand.

Process Functions

  • alarm — Schedules a SIGALRM signal to be delivered after a given number
  • die — Raises an exception, terminating execution unless caught by an eval
  • exec — Replaces the current process image with a new program via execvp(3).
  • exit — Terminates the program with the given exit status.
  • fork — Creates a child process by duplicating the current process.
  • kill — Sends a signal to one or more processes or process groups.
  • sleep — Suspends execution for the specified number of seconds.
  • system — Executes an external command and waits for it to complete.
  • wait — Waits for any child process to terminate.
  • waitpid — Waits for a specific child process to change state.
  • warn — Issues a warning message to STDERR without terminating the program.

Regular Expressions

  • m// — Tests a string against a regular expression pattern.
  • pos — Gets or sets the position of the last m//g match on a string.
  • qr — Creates a precompiled regular expression object.
  • quotemeta — Escapes all non-“word” characters with a preceding backslash.
  • s/// — Searches a string for a pattern and replaces matched text.
  • split — Splits a string into a list of substrings using a pattern.
  • tr — Performs character-by-character transliteration on a string.

Scope and Variables

  • bless — Associates a reference with a package, turning it into an object.
  • caller — Returns information about the calling subroutine’s context.
  • defined — Tests whether a value is defined (not undef).
  • do — Reads, compiles, and executes a Perl file, returning the value of
  • pos — Gets or sets the position of the last m//g match on a string.
  • prototype — Returns the prototype string of a subroutine, or undef if none.
  • ref — Returns the reference type or blessed class name of a value.
  • require — Loads and executes a Perl file or module, caching it in %INC so
  • reset — Resets ?? (one-shot match) operators so they can match again.
  • tie — Binds a variable to an object class, enabling magical access
  • tied — Returns the underlying object of a tied variable.
  • undef — Produces the undefined value, or undefines an existing variable.
  • untie — Removes the tie binding from a variable, restoring normal access.
  • vec — Treats a string as a bit vector and accesses individual bitfields.

String Functions

  • chomp — Removes the trailing record separator (default: newline) from each
  • chop — Removes the last character from each argument
  • chr — Converts a Unicode code point number to the corresponding character.
  • crypt — One-way password hashing using the system crypt(3) library.
  • hex — Interprets a hexadecimal string as an integer.
  • index — Finds the first occurrence of a substring within a string.
  • join — Concatenates a list of values into a single string with a separator.
  • lc — Converts a string to lowercase.
  • lcfirst — Lowercases the first character of a string.
  • length — Returns the number of characters in a string.
  • oct — Interprets a string as an octal number, with automatic prefix dispatch.
  • ord — Returns the Unicode code point of the first character of a string.
  • pack — Converts a list of values into a binary string according to a template.
  • quotemeta — Escapes all non-“word” characters with a preceding backslash.
  • reverse — Reverses a list of values or the characters of a string, depending
  • rindex — Finds the last occurrence of a substring within a string.
  • sprintf — Formats a string according to a printf-style format specification.
  • substr — and 3-argument forms)
  • uc — Converts a string to uppercase.
  • ucfirst — Uppercases the first character of a string.
  • unpack — Extracts values from a binary string according to a template.

Time Functions

  • gmtime — Converts a Unix timestamp to UTC (Greenwich Mean Time), returning
  • localtime — Converts a Unix timestamp to the local time zone, returning either
  • time — Returns the number of seconds since the Unix epoch.