פונקציות מובנות#

אינדקס אלפביתי של כל פונקציה מובנית של Perl 5. התוכן משקף את perldoc perlfunc עם סטיות ייחודיות ל־pperl המסומנות בתוך כל עמוד פירוט.

לתצוגת עיון חלופית מקובצת לפי תחום בעיה ראו פונקציות מובנות לפי קטגוריה.

A#

  • abs — Return the absolute value of a number.

  • accept — Accept an incoming connection on a listening socket.

  • alarm — Schedule a SIGALRM to be delivered to the current process after a whole number of wallclock seconds.

  • all — Test whether BLOCK returns true for every element of LIST.

  • any — Return true if BLOCK yields true for at least one element of LIST.

  • atan2 — Arc tangent of Y/X in the range -π to π.

B#

  • bind — Attach a local address to a socket.

  • binmode — Set the I/O layer stack on a filehandle - typically to make it deliver raw bytes, or to attach a character encoding.

  • bless — Mark the thing a reference points at as an object in a package.

  • break — Break out of a given block.

C#

  • caller — Return information about the subroutine, eval, or require that called the currently executing code.

  • catch — Handle an exception thrown by a preceding try block.

  • chdir — Change the process’s current working directory.

  • chmod — Change the permission bits of a list of files.

  • chomp — Strip the trailing input record separator from a string in place.

  • chop — Remove the last character from a string and return it.

  • chown — Change the owner and group of a list of files.

  • chr — Return the character whose codepoint is the given number.

  • chroot — Change the root directory of the current process and every child it later spawns.

  • class — Declare a namespace that behaves as a native object class.

  • close — Close a filehandle, flush its buffers, and release the underlying file descriptor.

  • closedir — Close a directory handle opened by opendir.

  • connect — Initiate a connection from a socket to a remote address.

  • continue — Attach a block to a loop that runs after every iteration, just before the condition is re-tested.

  • cos — Return the cosine of a number given in radians.

  • crypt — One-way passwd(5)-style hashing of a plaintext string with a salt.

D#

  • dbmclose — Break the binding between a DBM file and a hash previously attached by dbmopen.

  • dbmopen — Bind a DBM file on disk to a hash so hash reads and writes become lookups and stores in the database.

  • defer — Schedule a block to run when the enclosing scope exits, for any reason.

  • defined — Test whether a value, variable, or subroutine is defined.

  • delete — Remove the named key-value pair(s) from a hash, or element(s) from an array, and return what was removed.

  • die — Raise an exception.

  • do — Execute a block of code or run a Perl source file as if it were part of the current program.

  • dump — Cause the running program to produce a core dump immediately.

E#

  • each — Step through a hash or array one entry at a time.

  • endgrent — Close the group database after iterating it.

  • endhostent — Close the hosts database after iteration.

  • endnetent — Close the networks database after iteration.

  • endprotoent — Close the protocols database after iteration.

  • endpwent — Close the passwd-database iterator opened by getpwent or setpwent.

  • endservent — Close the services database after a walk with getservent.

  • eof — Test a filehandle for end-of-file.

  • eval — Run a piece of Perl code with any fatal error trapped instead of killing the program.

  • evalbytes — Compile and run a string of Perl source, forcing the source to be interpreted as bytes rather than characters.

  • exec — Abandon this program and run another in the same process.

  • exists — Test whether a hash or array element, or a named subroutine, is present - without creating it and without caring what it holds.

  • exit — Terminate the program with a status value.

  • exp — Raise e to a power.

F#

  • fc — Return the Unicode casefolded form of a string for case-insensitive comparison.

  • fcntl — Perform a fcntl(2) file-control operation on a filehandle.

  • field — Declare a per-instance variable inside a class block.

  • fileno — Return the OS-level file descriptor number behind a filehandle.

  • finally — Run cleanup code on the way out of a try/catch, whether the body succeeded, threw, or jumped away.

  • flock — Place an advisory lock on an open file.

  • fork — Create a new process running the same program at the same point.

  • format — Declare a picture-based report template for use by write.

  • formline — Format a list of values into a picture string and append the result to the format accumulator $^A.

G#

  • getc — Read the next single character from a filehandle.

  • getgrent — Read the next entry from the system group database.

  • getgrgid — Look up a group record by numeric group ID.

  • getgrnam — Look up a Unix group by name and return its /etc/group record.

  • gethostbyaddr — Look up a host record by its packed IP address.

  • gethostbyname — Look up a host record by DNS name.

  • gethostent — Fetch the next entry from the host database.

  • getlogin — Return the login name of the user associated with the controlling terminal.

  • getnetbyaddr — Look up a network record by its numeric network address.

  • getnetbyname — Look up a network record by name.

  • getnetent — Read the next entry from the networks database.

  • getpeername — Return the address of the remote end of a connected socket.

  • getpgrp — Return the POSIX process-group ID that a process belongs to.

  • getppid — Return the process ID of the current process’s parent.

  • getpriority — Return the current scheduling nice value of a process, a process group, or a user.

  • getprotobyname — Look up an IP protocol by its textual name and return its database entry.

  • getprotobynumber — Look up a network protocol entry by its assigned protocol number.

  • getprotoent — Fetch the next entry from the protocols database.

  • getpwent — Return the next entry from the system password database.

  • getpwnam — Look up a user’s passwd record by login name.

  • getpwuid — Look up a user’s passwd record by numeric UID.

  • getservbyname — Look up a network service by its textual name and protocol.

  • getservbyport — Look up a network service by its numeric port and protocol.

  • getservent — Read the next entry from the system services database.

  • getsockname — Return the local address of a connected or bound socket.

  • getsockopt — Read one socket option out of the kernel as an opaque packed string.

  • glob — Expand a shell-style filename pattern into the list of matching paths.

  • gmtime — Convert an epoch time to a broken-down UTC time, either as a 9-element list or as a ctime(3)-style string.

  • goto — Transfer execution elsewhere in the program without returning.

  • grep — Filter a list to the elements where the block or expression is true.

H#

  • hex — Interpret a string as a hexadecimal numeral and return its numeric value.

I#

  • import — Populate the caller’s namespace with names a module chooses to export.

  • index — Find the position of a substring inside a string.

  • int — Return the integer portion of a number, truncating toward zero.

  • ioctl — Perform a device-control ioctl(2) system call on a filehandle.

  • isa — Test whether an object is an instance of a class or of any subclass derived from it.

J#

  • join — Concatenate a list of strings with a separator between each adjacent pair, and return the single resulting string.

K#

  • keys — List all keys of a hash, or all indices of an array.

  • kill — Send a signal to a list of processes.

L#

  • last — Exit a loop immediately, skipping the rest of the body and the continue block.

  • lc — Return a lowercased copy of a string.

  • lcfirst — Return a copy of a string with its first character lowercased.

  • length — Return the number of characters in a string.

  • link — Create a hard link from NEWFILE to the existing OLDFILE.

  • listen — Mark a socket as passive so it can accept incoming connections.

  • local — Save the current value of a package variable and restore it when the enclosing scope exits.

  • localtime — Convert an epoch time to a broken-down calendar time in the local time zone.

  • lock — Place an advisory lock on a shared variable, array, hash, or subroutine until the lock goes out of scope.

  • log — Return the natural logarithm (base e) of a number.

  • lstat — Return the 13-element status list for a path without following a symbolic link.

M#

  • m// — Search a string for a pattern and report whether - and what - it matched.

  • map — Apply a block or expression to each element of a list and return the flattened results.

  • method — Declare a named instance method inside a class block.

  • mkdir — Create a single directory on the filesystem.

  • msgctl — Perform a control operation on a System V IPC message queue.

  • msgget — Create or look up a System V IPC message queue and return its id.

  • msgrcv — Receive a message from a System V IPC message queue.

  • msgsnd — Send a message to a System V IPC message queue.

  • my — Declare one or more lexically scoped variables.

N#

  • next — Start the next iteration of the enclosing loop immediately.

  • no — The compile-time inverse of use - call a module’s unimport method to turn off what use turned on.

O#

  • oct — Interpret a string as a number written in octal, hexadecimal, or binary, and return the resulting integer.

  • open — Associate a filehandle with a file, a command, or an in-memory scalar.

  • opendir — Open a directory for reading.

  • ord — Return the Unicode code point of the first character of a string.

  • our — Declare a lexically scoped alias to a package variable.

P#

  • pack — Convert a list of Perl values into a binary string according to a template.

  • package — Declare the compile-time namespace for the declarations that follow.

  • pipe — Open a pair of connected filehandles - one for reading, one for writing.

  • pop — Remove and return the last element of an array.

  • pos — Report or set where the next /g regex match will resume in a string.

  • print — Write a list of values to a filehandle.

  • printf — Write a formatted string to a filehandle.

  • prototype — Return the prototype string of a subroutine, or undef if it has none.

  • push — Append one or more values to the end of an array.

Q#

  • q// — Single-quoted string literal with a choice of delimiter.

  • qq// — Build a double-quoted, interpolated string with a delimiter you pick.

  • qr// — Compile a pattern once and hand back a reusable regex object.

  • quotemeta — Return a copy of a string with every regex-significant character backslash-escaped, so the result can be interpolated into a pattern and match its own literal content.

  • qw// — Build a list of barewords by splitting a delimited string on whitespace, without quoting or comma-separating each word.

  • qx// — Run a shell command and capture its standard output.

R#

  • rand — Return a pseudo-random floating-point number in the half-open range [0, EXPR).

  • read — Read a fixed amount of buffered input from a filehandle into a scalar.

  • readdir — Read the next entry, or all remaining entries, from a directory handle opened by opendir.

  • readline — Read one or more records from a filehandle.

  • readlink — Return the target path a symbolic link points to.

  • readpipe — Run a shell command and return its standard output.

  • recv — Read an incoming message from a socket into a scalar.

  • redo — Restart the current iteration of a loop without re-testing the condition and without running the continue block.

  • ref — Return a string describing what a reference points to.

  • rename — Change the name of a file.

  • require — Load a Perl source file at runtime, or demand a minimum Perl version.

  • reset — Clear every package variable whose name begins with one of a set of letters, and re-arm one-shot m?pattern? matches.

  • return — Leave the current subroutine, eval, do FILE, sort block, or regex eval block, yielding a value to the caller.

  • reverse — Reverse a list - or, in scalar context, reverse the characters of a string.

  • rewinddir — Reset a directory handle to the start of its listing.

  • rindex — Find the position of the last occurrence of a substring inside a string.

  • rmdir — Remove an empty directory.

S#

  • s/// — Search a string for a pattern and replace every match with a replacement.

  • say — Print a list of values followed by a newline.

  • scalar — Force EXPR to be evaluated in scalar context and return its value.

  • seek — Reposition a filehandle for random-access reads or writes.

  • seekdir — Restore a directory handle to a position previously captured by telldir.

  • select — Either set the default output filehandle, or call the select(2) syscall for I/O multiplexing. Same name, two unrelated jobs - disambiguated by argument count.

  • semctl — Perform a control operation on a System V semaphore set.

  • semget — Create or look up a System V semaphore set and return its identifier.

  • semop — Perform one or more System V semaphore operations atomically.

  • send — Send a message on a socket.

  • setgrent — Rewind the group-database iterator back to the first entry.

  • sethostent — Open or rewind the hosts database for iteration.

  • setnetent — Open or rewind the networks database for iteration.

  • setpgrp — Set the process group of a process.

  • setpriority — Set the scheduling priority (nice value) of a process, process group, or user.

  • setprotoent — Open the protocols database and prepare it for sequential reads.

  • setpwent — Rewind the password-database iterator so the next getpwent call returns the first entry again.

  • setservent — Rewind the services database and optionally keep it open across lookups.

  • setsockopt — Set a kernel-level option on an open socket.

  • shift — Remove and return the first element of an array.

  • shmctl — Control or query a System V shared memory segment.

  • shmget — Create or look up a System V shared memory segment and return its identifier.

  • shmread — Copy bytes out of a System V shared memory segment into a Perl scalar.

  • shmwrite — Copy bytes into a System V shared memory segment.

  • shutdown — Shut down one direction of a socket connection, or both.

  • sin — Return the sine of a number given in radians.

  • sleep — Pause the process for a number of whole seconds.

  • socket — Create a socket filehandle.

  • socketpair — Create an unnamed, connected pair of sockets that talk to each other.

  • sort — Sort a list, returning the sorted list.

  • splice — Remove and/or replace a slice of an array in place, and return the removed elements.

  • split — Cut a string into a list of fields using a regex separator.

  • sprintf — Build a formatted string from a format template and a list of values.

  • sqrt — Return the non-negative square root of EXPR.

  • srand — Seed the pseudo-random number generator.

  • stat — Get a file’s status information.

  • state — Declare a lexically scoped variable whose value persists across calls to its enclosing subroutine.

  • study — A no-op retained for source compatibility with older Perl code.

  • sub — Declare or define a subroutine.

  • substr — Extract, replace, or alias a contiguous slice of a string.

  • symlink — Create a symbolic link at NEWFILE that points at the string OLDFILE.

  • syscall — Invoke a raw system call by its kernel number, passing the remaining arguments as int or as a pointer to a string buffer.

  • sysopen — Open a file the low-level way, passing an integer MODE bitmask straight through to the underlying open(2) system call.

  • sysread — Read raw bytes from a filehandle by calling the underlying read(2) system call.

  • sysseek — Reposition a filehandle at the system level, bypassing PerlIO buffering.

  • system — Run a separate program and wait for it to finish.

  • syswrite — Write bytes to a filehandle with the raw write(2) system call, bypassing Perl’s buffered I/O.

T#

  • tell — Return the current byte position of a filehandle.

  • telldir — Return the current read position of a directory handle as an opaque token.

  • tie — Bind a variable to a class so that every access to the variable dispatches through that class’s methods.

  • tied — Return the object backing a tied variable.

  • time — Return the current wall-clock time as an integer number of seconds since the system epoch.

  • times — Report CPU time consumed by this process and its terminated children.

  • tr/// — Character-by-character substitution. tr scans a string and replaces every occurrence of a character from SEARCHLIST with the positionally corresponding character from REPLACEMENTLIST, returning the count of characters it touched.

  • truncate — Shorten (or extend) a file to an exact byte length.

  • try — Run a block and divert any exception it throws into a catch block, with an optional finally block that always runs on the way out.

U#

  • uc — Return an uppercased copy of a string.

  • ucfirst — Return a copy of a string with its first character titlecased.

  • umask — Set or read the process file-creation mode mask.

  • undef — The undefined value, and the operator that produces it.

  • unlink — Remove one or more directory entries that name files.

  • unpack — Extract typed values from a binary or fixed-width string according to a template.

  • unshift — Prepend one or more values to the start of an array and return the array’s new length.

  • untie — Break the binding between a variable and its tied class.

  • use — Load a module at compile time and import its symbols into the current package.

  • utime — Set access and modification times on a list of files.

V#

  • values — List every value of a hash (or every element of an array).

  • vec — Read or write a fixed-width slot inside a string treated as a packed bit vector.

W#

  • wait — Block until any child process exits and reap it.

  • waitpid — Wait for a specific child process to terminate and reap it.

  • wantarray — Report the calling context of the currently executing subroutine.

  • warn — Emit a warning to STDERR.

  • write — Render one record to a filehandle through its associated format.

Y#

  • y/// — Transliterate characters in a string. y/// is a synonym for tr/// - the two are identical in every respect.

__ (קווים תחתונים כפולים)#

  • __CLASS__ — Return the class name of the instance currently being acted on.

  • __FILE__ — The name of the source file the token is compiled in.

  • __LINE__ — A compile-time token that evaluates to the line number at which it appears in the source.

  • __PACKAGE__ — Return the name of the package currently in effect at the point where the token appears.

  • __SUB__ — Return a reference to the currently executing subroutine.