{
    "content": [
        {
            "type": "text",
            "text": "# PERLFUNC(1) (man)\n\n**Summary:** perlfunc - Perl builtin functions\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **DESCRIPTION** (72 lines) — 4 subsections\n  - Perl Functions by Category (110 lines)\n  - Portability (19 lines)\n  - Alphabetical Listing of Perl Functions (7301 lines)\n  - Non-function Keywords by Cross-reference (68 lines)\n\n## Full Content\n\n### NAME\n\nperlfunc - Perl builtin functions\n\n### DESCRIPTION\n\nThe functions in this section can serve as terms in an expression.  They fall into two major\ncategories: list operators and named unary operators.  These differ in their precedence\nrelationship with a following comma.  (See the precedence table in perlop.)  List operators\ntake more than one argument, while unary operators can never take more than one argument.\nThus, a comma terminates the argument of a unary operator, but merely separates the arguments\nof a list operator.  A unary operator generally provides scalar context to its argument,\nwhile a list operator may provide either scalar or list contexts for its arguments.  If it\ndoes both, scalar arguments come first and list argument follow, and there can only ever be\none such list argument.  For instance, \"splice\" has three scalar arguments followed by a\nlist, whereas \"gethostbyname\" has four scalar arguments.\n\nIn the syntax descriptions that follow, list operators that expect a list (and provide list\ncontext for elements of the list) are shown with LIST as an argument.  Such a list may\nconsist of any combination of scalar arguments or list values; the list values will be\nincluded in the list as if each individual element were interpolated at that point in the\nlist, forming a longer single-dimensional list value.  Commas should separate literal\nelements of the LIST.\n\nAny function in the list below may be used either with or without parentheses around its\narguments.  (The syntax descriptions omit the parentheses.)  If you use parentheses, the\nsimple but occasionally surprising rule is this: It looks like a function, therefore it is a\nfunction, and precedence doesn't matter.  Otherwise it's a list operator or unary operator,\nand precedence does matter.  Whitespace between the function and left parenthesis doesn't\ncount, so sometimes you need to be careful:\n\nprint 1+2+4;      # Prints 7.\nprint(1+2) + 4;   # Prints 3.\nprint (1+2)+4;    # Also prints 3!\nprint +(1+2)+4;   # Prints 7.\nprint ((1+2)+4);  # Prints 7.\n\nIf you run Perl with the \"use warnings\" pragma, it can warn you about this.  For example, the\nthird line above produces:\n\nprint (...) interpreted as function at - line 1.\nUseless use of integer addition in void context at - line 1.\n\nA few functions take no arguments at all, and therefore work as neither unary nor list\noperators.  These include such functions as \"time\" and \"endpwent\".  For example,\n\"time+86400\" always means \"time() + 86400\".\n\nFor functions that can be used in either a scalar or list context, nonabortive failure is\ngenerally indicated in scalar context by returning the undefined value, and in list context\nby returning the empty list.\n\nRemember the following important rule: There is no rule that relates the behavior of an\nexpression in list context to its behavior in scalar context, or vice versa.  It might do two\ntotally different things.  Each operator and function decides which sort of value would be\nmost appropriate to return in scalar context.  Some operators return the length of the list\nthat would have been returned in list context.  Some operators return the first value in the\nlist.  Some operators return the last value in the list.  Some operators return a count of\nsuccessful operations.  In general, they do what you want, unless you want consistency.\n\nA named array in scalar context is quite different from what would at first glance appear to\nbe a list in scalar context.  You can't get a list like \"(1,2,3)\" into being in scalar\ncontext, because the compiler knows the context at compile time.  It would generate the\nscalar comma operator there, not the list concatenation version of the comma.  That means it\nwas never a list to start with.\n\nIn general, functions in Perl that serve as wrappers for system calls (\"syscalls\") of the\nsame name (like chown(2), fork(2), closedir(2), etc.) return true when they succeed and\n\"undef\" otherwise, as is usually mentioned in the descriptions below.  This is different from\nthe C interfaces, which return \"-1\" on failure.  Exceptions to this rule include \"wait\",\n\"waitpid\", and \"syscall\".  System calls also set the special $! variable on failure.  Other\nfunctions do not, except accidentally.\n\nExtension modules can also hook into the Perl parser to define new kinds of keyword-headed\nexpression.  These may look like functions, but may also look completely different.  The\nsyntax following the keyword is defined entirely by the extension.  If you are an\nimplementor, see \"PLkeywordplugin\" in perlapi for the mechanism.  If you are using such a\nmodule, see the module's documentation for details of the syntax that it defines.\n\n#### Perl Functions by Category\n\nHere are Perl's functions (including things that look like functions, like some keywords and\nnamed operators) arranged by category.  Some functions appear in more than one place.  Any\nwarnings, including those produced by keywords, are described in perldiag and warnings.\n\nFunctions for SCALARs or strings\n\"chomp\", \"chop\", \"chr\", \"crypt\", \"fc\", \"hex\", \"index\", \"lc\", \"lcfirst\", \"length\", \"oct\",\n\"ord\", \"pack\", \"q//\", \"qq//\", \"reverse\", \"rindex\", \"sprintf\", \"substr\", \"tr///\", \"uc\",\n\"ucfirst\", \"y///\"\n\n\"fc\" is available only if the \"fc\" feature is enabled or if it is prefixed with \"CORE::\".\nThe \"fc\" feature is enabled automatically with a \"use v5.16\" (or higher) declaration in\nthe current scope.\n\nRegular expressions and pattern matching\n\"m//\", \"pos\", \"qr//\", \"quotemeta\", \"s///\", \"split\", \"study\"\n\nNumeric functions\n\"abs\", \"atan2\", \"cos\", \"exp\", \"hex\", \"int\", \"log\", \"oct\", \"rand\", \"sin\", \"sqrt\", \"srand\"\n\nFunctions for real @ARRAYs\n\"each\", \"keys\", \"pop\", \"push\", \"shift\", \"splice\", \"unshift\", \"values\"\n\nFunctions for list data\n\"grep\", \"join\", \"map\", \"qw//\", \"reverse\", \"sort\", \"unpack\"\n\nFunctions for real %HASHes\n\"delete\", \"each\", \"exists\", \"keys\", \"values\"\n\nInput and output functions\n\"binmode\", \"close\", \"closedir\", \"dbmclose\", \"dbmopen\", \"die\", \"eof\", \"fileno\", \"flock\",\n\"format\", \"getc\", \"print\", \"printf\", \"read\", \"readdir\", \"readline\", \"rewinddir\", \"say\",\n\"seek\", \"seekdir\", \"select\", \"syscall\", \"sysread\", \"sysseek\", \"syswrite\", \"tell\",\n\"telldir\", \"truncate\", \"warn\", \"write\"\n\n\"say\" is available only if the \"say\" feature is enabled or if it is prefixed with\n\"CORE::\".  The \"say\" feature is enabled automatically with a \"use v5.10\" (or higher)\ndeclaration in the current scope.\n\nFunctions for fixed-length data or records\n\"pack\", \"read\", \"syscall\", \"sysread\", \"sysseek\", \"syswrite\", \"unpack\", \"vec\"\n\nFunctions for filehandles, files, or directories\n\"-X\", \"chdir\", \"chmod\", \"chown\", \"chroot\", \"fcntl\", \"glob\", \"ioctl\", \"link\", \"lstat\",\n\"mkdir\", \"open\", \"opendir\", \"readlink\", \"rename\", \"rmdir\", \"select\", \"stat\", \"symlink\",\n\"sysopen\", \"umask\", \"unlink\", \"utime\"\n\nKeywords related to the control flow of your Perl program\n\"break\", \"caller\", \"continue\", \"die\", \"do\", \"dump\", \"eval\", \"evalbytes\", \"exit\",\n\"FILE\", \"goto\", \"last\", \"LINE\", \"next\", \"PACKAGE\", \"redo\", \"return\", \"sub\",\n\"SUB\", \"wantarray\"\n\n\"break\" is available only if you enable the experimental \"switch\" feature or use the\n\"CORE::\" prefix.  The \"switch\" feature also enables the \"default\", \"given\" and \"when\"\nstatements, which are documented in \"Switch Statements\" in perlsyn.  The \"switch\" feature\nis enabled automatically with a \"use v5.10\" (or higher) declaration in the current scope.\nIn Perl v5.14 and earlier, \"continue\" required the \"switch\" feature, like the other\nkeywords.\n\n\"evalbytes\" is only available with the \"evalbytes\" feature (see feature) or if prefixed\nwith \"CORE::\".  \"SUB\" is only available with the \"currentsub\" feature or if prefixed\nwith \"CORE::\".  Both the \"evalbytes\" and \"currentsub\" features are enabled automatically\nwith a \"use v5.16\" (or higher) declaration in the current scope.\n\nKeywords related to scoping\n\"caller\", \"import\", \"local\", \"my\", \"our\", \"package\", \"state\", \"use\"\n\n\"state\" is available only if the \"state\" feature is enabled or if it is prefixed with\n\"CORE::\".  The \"state\" feature is enabled automatically with a \"use v5.10\" (or higher)\ndeclaration in the current scope.\n\nMiscellaneous functions\n\"defined\", \"formline\", \"lock\", \"prototype\", \"reset\", \"scalar\", \"undef\"\n\nFunctions for processes and process groups\n\"alarm\", \"exec\", \"fork\", \"getpgrp\", \"getppid\", \"getpriority\", \"kill\", \"pipe\", \"qx//\",\n\"readpipe\", \"setpgrp\", \"setpriority\", \"sleep\", \"system\", \"times\", \"wait\", \"waitpid\"\n\nKeywords related to Perl modules\n\"do\", \"import\", \"no\", \"package\", \"require\", \"use\"\n\nKeywords related to classes and object-orientation\n\"bless\", \"dbmclose\", \"dbmopen\", \"package\", \"ref\", \"tie\", \"tied\", \"untie\", \"use\"\n\nLow-level socket functions\n\"accept\", \"bind\", \"connect\", \"getpeername\", \"getsockname\", \"getsockopt\", \"listen\",\n\"recv\", \"send\", \"setsockopt\", \"shutdown\", \"socket\", \"socketpair\"\n\nSystem V interprocess communication functions\n\"msgctl\", \"msgget\", \"msgrcv\", \"msgsnd\", \"semctl\", \"semget\", \"semop\", \"shmctl\", \"shmget\",\n\"shmread\", \"shmwrite\"\n\nFetching user and group info\n\"endgrent\", \"endhostent\", \"endnetent\", \"endpwent\", \"getgrent\", \"getgrgid\", \"getgrnam\",\n\"getlogin\", \"getpwent\", \"getpwnam\", \"getpwuid\", \"setgrent\", \"setpwent\"\n\nFetching network info\n\"endprotoent\", \"endservent\", \"gethostbyaddr\", \"gethostbyname\", \"gethostent\",\n\"getnetbyaddr\", \"getnetbyname\", \"getnetent\", \"getprotobyname\", \"getprotobynumber\",\n\"getprotoent\", \"getservbyname\", \"getservbyport\", \"getservent\", \"sethostent\", \"setnetent\",\n\"setprotoent\", \"setservent\"\n\nTime-related functions\n\"gmtime\", \"localtime\", \"time\", \"times\"\n\nNon-function keywords\n\"and\", \"AUTOLOAD\", \"BEGIN\", \"CHECK\", \"cmp\", \"CORE\", \"DATA\", \"default\", \"DESTROY\",\n\"else\", \"elseif\", \"elsif\", \"END\", \"END\", \"eq\", \"for\", \"foreach\", \"ge\", \"given\", \"gt\",\n\"if\", \"INIT\", \"le\", \"lt\", \"ne\", \"not\", \"or\", \"UNITCHECK\", \"unless\", \"until\", \"when\",\n\"while\", \"x\", \"xor\"\n\n#### Portability\n\nPerl was born in Unix and can therefore access all common Unix system calls.  In non-Unix\nenvironments, the functionality of some Unix system calls may not be available or details of\nthe available functionality may differ slightly.  The Perl functions affected by this are:\n\n\"-X\", \"binmode\", \"chmod\", \"chown\", \"chroot\", \"crypt\", \"dbmclose\", \"dbmopen\", \"dump\",\n\"endgrent\", \"endhostent\", \"endnetent\", \"endprotoent\", \"endpwent\", \"endservent\", \"exec\",\n\"fcntl\", \"flock\", \"fork\", \"getgrent\", \"getgrgid\", \"gethostbyname\", \"gethostent\", \"getlogin\",\n\"getnetbyaddr\", \"getnetbyname\", \"getnetent\", \"getppid\", \"getpgrp\", \"getpriority\",\n\"getprotobynumber\", \"getprotoent\", \"getpwent\", \"getpwnam\", \"getpwuid\", \"getservbyport\",\n\"getservent\", \"getsockopt\", \"glob\", \"ioctl\", \"kill\", \"link\", \"lstat\", \"msgctl\", \"msgget\",\n\"msgrcv\", \"msgsnd\", \"open\", \"pipe\", \"readlink\", \"rename\", \"select\", \"semctl\", \"semget\",\n\"semop\", \"setgrent\", \"sethostent\", \"setnetent\", \"setpgrp\", \"setpriority\", \"setprotoent\",\n\"setpwent\", \"setservent\", \"setsockopt\", \"shmctl\", \"shmget\", \"shmread\", \"shmwrite\", \"socket\",\n\"socketpair\", \"stat\", \"symlink\", \"syscall\", \"sysopen\", \"system\", \"times\", \"truncate\",\n\"umask\", \"unlink\", \"utime\", \"wait\", \"waitpid\"\n\nFor more information about the portability of these functions, see perlport and other\navailable platform-specific documentation.\n\n#### Alphabetical Listing of Perl Functions\n\n-X FILEHANDLE\n-X EXPR\n-X DIRHANDLE\n-X  A file test, where X is one of the letters listed below.  This unary operator takes one\nargument, either a filename, a filehandle, or a dirhandle, and tests the associated file\nto see if something is true about it.  If the argument is omitted, tests $, except for\n\"-t\", which tests STDIN.  Unless otherwise documented, it returns 1 for true and '' for\nfalse.  If the file doesn't exist or can't be examined, it returns \"undef\" and sets $!\n(errno).  With the exception of the \"-l\" test they all follow symbolic links because they\nuse \"stat()\" and not \"lstat()\" (so dangling symlinks can't be examined and will therefore\nreport failure).\n\nDespite the funny names, precedence is the same as any other named unary operator.  The\noperator may be any of:\n\n-r  File is readable by effective uid/gid.\n-w  File is writable by effective uid/gid.\n-x  File is executable by effective uid/gid.\n-o  File is owned by effective uid.\n\n-R  File is readable by real uid/gid.\n-W  File is writable by real uid/gid.\n-X  File is executable by real uid/gid.\n-O  File is owned by real uid.\n\n-e  File exists.\n-z  File has zero size (is empty).\n-s  File has nonzero size (returns size in bytes).\n\n-f  File is a plain file.\n-d  File is a directory.\n-l  File is a symbolic link (false if symlinks aren't\nsupported by the file system).\n-p  File is a named pipe (FIFO), or Filehandle is a pipe.\n-S  File is a socket.\n-b  File is a block special file.\n-c  File is a character special file.\n-t  Filehandle is opened to a tty.\n\n-u  File has setuid bit set.\n-g  File has setgid bit set.\n-k  File has sticky bit set.\n\n-T  File is an ASCII or UTF-8 text file (heuristic guess).\n-B  File is a \"binary\" file (opposite of -T).\n\n-M  Script start time minus file modification time, in days.\n-A  Same for access time.\n-C  Same for inode change time (Unix, may differ for other\nplatforms)\n\nExample:\n\nwhile (<>) {\nchomp;\nnext unless -f $;  # ignore specials\n#...\n}\n\nNote that \"-s/a/b/\" does not do a negated substitution.  Saying \"-exp($foo)\" still works\nas expected, however: only single letters following a minus are interpreted as file\ntests.\n\nThese operators are exempt from the \"looks like a function rule\" described above.  That\nis, an opening parenthesis after the operator does not affect how much of the following\ncode constitutes the argument.  Put the opening parentheses before the operator to\nseparate it from code that follows (this applies only to operators with higher precedence\nthan unary operators, of course):\n\n-s($file) + 1024   # probably wrong; same as -s($file + 1024)\n(-s $file) + 1024  # correct\n\nThe interpretation of the file permission operators \"-r\", \"-R\", \"-w\", \"-W\", \"-x\", and\n\"-X\" is by default based solely on the mode of the file and the uids and gids of the\nuser.  There may be other reasons you can't actually read, write, or execute the file:\nfor example network filesystem access controls, ACLs (access control lists), read-only\nfilesystems, and unrecognized executable formats.  Note that the use of these six\nspecific operators to verify if some operation is possible is usually a mistake, because\nit may be open to race conditions.\n\nAlso note that, for the superuser on the local filesystems, the \"-r\", \"-R\", \"-w\", and\n\"-W\" tests always return 1, and \"-x\" and \"-X\" return 1 if any execute bit is set in the\nmode.  Scripts run by the superuser may thus need to do a \"stat\" to determine the actual\nmode of the file, or temporarily set their effective uid to something else.\n\nIf you are using ACLs, there is a pragma called \"filetest\" that may produce more accurate\nresults than the bare \"stat\" mode bits.  When under \"use filetest 'access'\", the above-\nmentioned filetests test whether the permission can(not) be granted using the access(2)\nfamily of system calls.  Also note that the \"-x\" and \"-X\" tests may under this pragma\nreturn true even if there are no execute permission bits set (nor any extra execute\npermission ACLs).  This strangeness is due to the underlying system calls' definitions.\nNote also that, due to the implementation of \"use filetest 'access'\", the \"\" special\nfilehandle won't cache the results of the file tests when this pragma is in effect.  Read\nthe documentation for the \"filetest\" pragma for more information.\n\nThe \"-T\" and \"-B\" tests work as follows.  The first block or so of the file is examined\nto see if it is valid UTF-8 that includes non-ASCII characters.  If so, it's a \"-T\" file.\nOtherwise, that same portion of the file is examined for odd characters such as strange\ncontrol codes or characters with the high bit set.  If more than a third of the\ncharacters are strange, it's a \"-B\" file; otherwise it's a \"-T\" file.  Also, any file\ncontaining a zero byte in the examined portion is considered a binary file.  (If executed\nwithin the scope of a use locale which includes \"LCCTYPE\", odd characters are anything\nthat isn't a printable nor space in the current locale.)  If \"-T\" or \"-B\" is used on a\nfilehandle, the current IO buffer is examined rather than the first block.  Both \"-T\" and\n\"-B\" return true on an empty file, or a file at EOF when testing a filehandle.  Because\nyou have to read a file to do the \"-T\" test, on most occasions you want to use a \"-f\"\nagainst the file first, as in \"next unless -f $file && -T $file\".\n\nIf any of the file tests (or either the \"stat\" or \"lstat\" operator) is given the special\nfilehandle consisting of a solitary underline, then the stat structure of the previous\nfile test (or \"stat\" operator) is used, saving a system call.  (This doesn't work with\n\"-t\", and you need to remember that \"lstat\" and \"-l\" leave values in the stat structure\nfor the symbolic link, not the real file.)  (Also, if the stat buffer was filled by an\n\"lstat\" call, \"-T\" and \"-B\" will reset it with the results of \"stat \").  Example:\n\nprint \"Can do.\\n\" if -r $a || -w  || -x ;\n\nstat($filename);\nprint \"Readable\\n\" if -r ;\nprint \"Writable\\n\" if -w ;\nprint \"Executable\\n\" if -x ;\nprint \"Setuid\\n\" if -u ;\nprint \"Setgid\\n\" if -g ;\nprint \"Sticky\\n\" if -k ;\nprint \"Text\\n\" if -T ;\nprint \"Binary\\n\" if -B ;\n\nAs of Perl 5.10.0, as a form of purely syntactic sugar, you can stack file test\noperators, in a way that \"-f -w -x $file\" is equivalent to \"-x $file && -w  && -f \".\n(This is only fancy syntax: if you use the return value of \"-f $file\" as an argument to\nanother filetest operator, no special magic will happen.)\n\nPortability issues: \"-X\" in perlport.\n\nTo avoid confusing would-be users of your code with mysterious syntax errors, put\nsomething like this at the top of your script:\n\nuse 5.010;  # so filetest ops can stack\n\nabs VALUE\nabs Returns the absolute value of its argument.  If VALUE is omitted, uses $.\n\naccept NEWSOCKET,GENERICSOCKET\nAccepts an incoming socket connect, just as accept(2) does.  Returns the packed address\nif it succeeded, false otherwise.  See the example in \"Sockets: Client/Server\nCommunication\" in perlipc.\n\nOn systems that support a close-on-exec flag on files, the flag will be set for the newly\nopened file descriptor, as determined by the value of $^F.  See \"$^F\" in perlvar.\n\nalarm SECONDS\nalarm\nArranges to have a SIGALRM delivered to this process after the specified number of\nwallclock seconds has elapsed.  If SECONDS is not specified, the value stored in $ is\nused.  (On some machines, unfortunately, the elapsed time may be up to one second less or\nmore than you specified because of how seconds are counted, and process scheduling may\ndelay the delivery of the signal even further.)\n\nOnly one timer may be counting at once.  Each call disables the previous timer, and an\nargument of 0 may be supplied to cancel the previous timer without starting a new one.\nThe returned value is the amount of time remaining on the previous timer.\n\nFor delays of finer granularity than one second, the Time::HiRes module (from CPAN, and\nstarting from Perl 5.8 part of the standard distribution) provides \"ualarm\".  You may\nalso use Perl's four-argument version of \"select\" leaving the first three arguments\nundefined, or you might be able to use the \"syscall\" interface to access setitimer(2) if\nyour system supports it.  See perlfaq8 for details.\n\nIt is usually a mistake to intermix \"alarm\" and \"sleep\" calls, because \"sleep\" may be\ninternally implemented on your system with \"alarm\".\n\nIf you want to use \"alarm\" to time out a system call you need to use an \"eval\"/\"die\"\npair.  You can't rely on the alarm causing the system call to fail with $! set to \"EINTR\"\nbecause Perl sets up signal handlers to restart system calls on some systems.  Using\n\"eval\"/\"die\" always works, modulo the caveats given in \"Signals\" in perlipc.\n\neval {\nlocal $SIG{ALRM} = sub { die \"alarm\\n\" }; # NB: \\n required\nalarm $timeout;\nmy $nread = sysread $socket, $buffer, $size;\nalarm 0;\n};\nif ($@) {\ndie unless $@ eq \"alarm\\n\";   # propagate unexpected errors\n# timed out\n}\nelse {\n# didn't\n}\n\nFor more information see perlipc.\n\nPortability issues: \"alarm\" in perlport.\n\natan2 Y,X\nReturns the arctangent of Y/X in the range -PI to PI.\n\nFor the tangent operation, you may use the \"Math::Trig::tan\" function, or use the\nfamiliar relation:\n\nsub tan { sin($[0]) / cos($[0])  }\n\nThe return value for \"atan2(0,0)\" is implementation-defined; consult your atan2(3)\nmanpage for more information.\n\nPortability issues: \"atan2\" in perlport.\n\nbind SOCKET,NAME\nBinds a network address to a socket, just as bind(2) does.  Returns true if it succeeded,\nfalse otherwise.  NAME should be a packed address of the appropriate type for the socket.\nSee the examples in \"Sockets: Client/Server Communication\" in perlipc.\n\nbinmode FILEHANDLE, LAYER\nbinmode FILEHANDLE\nArranges for FILEHANDLE to be read or written in \"binary\" or \"text\" mode on systems where\nthe run-time libraries distinguish between binary and text files.  If FILEHANDLE is an\nexpression, the value is taken as the name of the filehandle.  Returns true on success,\notherwise it returns \"undef\" and sets $! (errno).\n\nOn some systems (in general, DOS- and Windows-based systems) \"binmode\" is necessary when\nyou're not working with a text file.  For the sake of portability it is a good idea\nalways to use it when appropriate, and never to use it when it isn't appropriate.  Also,\npeople can set their I/O to be by default UTF8-encoded Unicode, not bytes.\n\nIn other words: regardless of platform, use \"binmode\" on binary data, like images, for\nexample.\n\nIf LAYER is present it is a single string, but may contain multiple directives.  The\ndirectives alter the behaviour of the filehandle.  When LAYER is present, using binmode\non a text file makes sense.\n\nIf LAYER is omitted or specified as \":raw\" the filehandle is made suitable for passing\nbinary data.  This includes turning off possible CRLF translation and marking it as bytes\n(as opposed to Unicode characters).  Note that, despite what may be implied in\n\"Programming Perl\" (the Camel, 3rd edition) or elsewhere, \":raw\" is not simply the\ninverse of \":crlf\".  Other layers that would affect the binary nature of the stream are\nalso disabled.  See PerlIO, and the discussion about the PERLIO environment variable in\nperlrun.\n\nThe \":bytes\", \":crlf\", \":utf8\", and any other directives of the form \":...\", are called\nI/O layers.  The open pragma can be used to establish default I/O layers.\n\nThe LAYER parameter of the \"binmode\" function is described as \"DISCIPLINE\" in\n\"Programming Perl, 3rd Edition\".  However, since the publishing of this book, by many\nknown as \"Camel III\", the consensus of the naming of this functionality has moved from\n\"discipline\" to \"layer\".  All documentation of this version of Perl therefore refers to\n\"layers\" rather than to \"disciplines\".  Now back to the regularly scheduled\ndocumentation...\n\nTo mark FILEHANDLE as UTF-8, use \":utf8\" or \":encoding(UTF-8)\".  \":utf8\" just marks the\ndata as UTF-8 without further checking, while \":encoding(UTF-8)\" checks the data for\nactually being valid UTF-8.  More details can be found in PerlIO::encoding.\n\nIn general, \"binmode\" should be called after \"open\" but before any I/O is done on the\nfilehandle.  Calling \"binmode\" normally flushes any pending buffered output data (and\nperhaps pending input data) on the handle.  An exception to this is the \":encoding\" layer\nthat changes the default character encoding of the handle.  The \":encoding\" layer\nsometimes needs to be called in mid-stream, and it doesn't flush the stream.  \":encoding\"\nalso implicitly pushes on top of itself the \":utf8\" layer because internally Perl\noperates on UTF8-encoded Unicode characters.\n\nThe operating system, device drivers, C libraries, and Perl run-time system all conspire\nto let the programmer treat a single character (\"\\n\") as the line terminator,\nirrespective of external representation.  On many operating systems, the native text file\nrepresentation matches the internal representation, but on some platforms the external\nrepresentation of \"\\n\" is made up of more than one character.\n\nAll variants of Unix, Mac OS (old and new), and StreamLF files on VMS use a single\ncharacter to end each line in the external representation of text (even though that\nsingle character is CARRIAGE RETURN on old, pre-Darwin flavors of Mac OS, and is LINE\nFEED on Unix and most VMS files).  In other systems like OS/2, DOS, and the various\nflavors of MS-Windows, your program sees a \"\\n\" as a simple \"\\cJ\", but what's stored in\ntext files are the two characters \"\\cM\\cJ\".  That means that if you don't use \"binmode\"\non these systems, \"\\cM\\cJ\" sequences on disk will be converted to \"\\n\" on input, and any\n\"\\n\" in your program will be converted back to \"\\cM\\cJ\" on output.  This is what you want\nfor text files, but it can be disastrous for binary files.\n\nAnother consequence of using \"binmode\" (on some systems) is that special end-of-file\nmarkers will be seen as part of the data stream.  For systems from the Microsoft family\nthis means that, if your binary data contain \"\\cZ\", the I/O subsystem will regard it as\nthe end of the file, unless you use \"binmode\".\n\n\"binmode\" is important not only for \"readline\" and \"print\" operations, but also when\nusing \"read\", \"seek\", \"sysread\", \"syswrite\" and \"tell\" (see perlport for more details).\nSee the $/ and \"$\\\" variables in perlvar for how to manually set your input and output\nline-termination sequences.\n\nPortability issues: \"binmode\" in perlport.\n\nbless REF,CLASSNAME\nbless REF\nThis function tells the thingy referenced by REF that it is now an object in the\nCLASSNAME package.  If CLASSNAME is an empty string, it is interpreted as referring to\nthe \"main\" package.  If CLASSNAME is omitted, the current package is used.  Because a\n\"bless\" is often the last thing in a constructor, it returns the reference for\nconvenience.  Always use the two-argument version if a derived class might inherit the\nmethod doing the blessing.  See perlobj for more about the blessing (and blessings) of\nobjects.\n\nConsider always blessing objects in CLASSNAMEs that are mixed case.  Namespaces with all\nlowercase names are considered reserved for Perl pragmas.  Builtin types have all\nuppercase names.  To prevent confusion, you may wish to avoid such package names as well.\nIt is advised to avoid the class name 0, because much code erroneously uses the result of\n\"ref\" as a truth value.\n\nSee \"Perl Modules\" in perlmod.\n\nbreak\nBreak out of a \"given\" block.\n\n\"break\" is available only if the \"switch\" feature is enabled or if it is prefixed with\n\"CORE::\". The \"switch\" feature is enabled automatically with a \"use v5.10\" (or higher)\ndeclaration in the current scope.\n\ncaller EXPR\ncaller\nReturns the context of the current pure perl subroutine call.  In scalar context, returns\nthe caller's package name if there is a caller (that is, if we're in a subroutine or\n\"eval\" or \"require\") and the undefined value otherwise.  caller never returns XS subs and\nthey are skipped.  The next pure perl sub will appear instead of the XS sub in caller's\nreturn values.  In list context, caller returns\n\n# 0         1          2\nmy ($package, $filename, $line) = caller;\n\nLike \"FILE\" and \"LINE\", the filename and line number returned here may be altered\nby the mechanism described at \"Plain Old Comments (Not!)\" in perlsyn.\n\nWith EXPR, it returns some extra information that the debugger uses to print a stack\ntrace.  The value of EXPR indicates how many call frames to go back before the current\none.\n\n#  0         1          2      3            4\nmy ($package, $filename, $line, $subroutine, $hasargs,\n\n#  5          6          7            8       9         10\n$wantarray, $evaltext, $isrequire, $hints, $bitmask, $hinthash)\n= caller($i);\n\nHere, $subroutine is the function that the caller called (rather than the function\ncontaining the caller).  Note that $subroutine may be \"(eval)\" if the frame is not a\nsubroutine call, but an \"eval\".  In such a case additional elements $evaltext and\n$isrequire are set: $isrequire is true if the frame is created by a \"require\" or \"use\"\nstatement, $evaltext contains the text of the \"eval EXPR\" statement.  In particular, for\nan \"eval BLOCK\" statement, $subroutine is \"(eval)\", but $evaltext is undefined.  (Note\nalso that each \"use\" statement creates a \"require\" frame inside an \"eval EXPR\" frame.)\n$subroutine may also be \"(unknown)\" if this particular subroutine happens to have been\ndeleted from the symbol table.  $hasargs is true if a new instance of @ was set up for\nthe frame.  $hints and $bitmask contain pragmatic hints that the caller was compiled\nwith.  $hints corresponds to $^H, and $bitmask corresponds to \"${^WARNINGBITS}\".  The\n$hints and $bitmask values are subject to change between versions of Perl, and are not\nmeant for external use.\n\n$hinthash is a reference to a hash containing the value of \"%^H\" when the caller was\ncompiled, or \"undef\" if \"%^H\" was empty.  Do not modify the values of this hash, as they\nare the actual values stored in the optree.\n\nNote that the only types of call frames that are visible are subroutine calls and \"eval\".\nOther forms of context, such as \"while\" or \"foreach\" loops or \"try\" blocks are not\nconsidered interesting to \"caller\", as they do not alter the behaviour of the \"return\"\nexpression.\n\nFurthermore, when called from within the DB package in list context, and with an\nargument, caller returns more detailed information: it sets the list variable @DB::args\nto be the arguments with which the subroutine was invoked.\n\nBe aware that the optimizer might have optimized call frames away before \"caller\" had a\nchance to get the information.  That means that caller(N) might not return information\nabout the call frame you expect it to, for \"N > 1\".  In particular, @DB::args might have\ninformation from the previous time \"caller\" was called.\n\nBe aware that setting @DB::args is best effort, intended for debugging or generating\nbacktraces, and should not be relied upon.  In particular, as @ contains aliases to the\ncaller's arguments, Perl does not take a copy of @, so @DB::args will contain\nmodifications the subroutine makes to @ or its contents, not the original values at call\ntime.  @DB::args, like @, does not hold explicit references to its elements, so under\ncertain cases its elements may have become freed and reallocated for other variables or\ntemporary values.  Finally, a side effect of the current implementation is that the\neffects of \"shift @\" can normally be undone (but not \"pop @\" or other splicing, and not\nif a reference to @ has been taken, and subject to the caveat about reallocated\nelements), so @DB::args is actually a hybrid of the current state and initial state of\n@.  Buyer beware.\n\nchdir EXPR\nchdir FILEHANDLE\nchdir DIRHANDLE\nchdir\nChanges the working directory to EXPR, if possible.  If EXPR is omitted, changes to the\ndirectory specified by $ENV{HOME}, if set; if not, changes to the directory specified by\n$ENV{LOGDIR}.  (Under VMS, the variable $ENV{'SYS$LOGIN'} is also checked, and used if it\nis set.)  If neither is set, \"chdir\" does nothing and fails.  It returns true on success,\nfalse otherwise.  See the example under \"die\".\n\nOn systems that support fchdir(2), you may pass a filehandle or directory handle as the\nargument.  On systems that don't support fchdir(2), passing handles raises an exception.\n\nchmod LIST\nChanges the permissions of a list of files.  The first element of the list must be the\nnumeric mode, which should probably be an octal number, and which definitely should not\nbe a string of octal digits: 0644 is okay, but \"0644\" is not.  Returns the number of\nfiles successfully changed.  See also \"oct\" if all you have is a string.\n\nmy $cnt = chmod 0755, \"foo\", \"bar\";\nchmod 0755, @executables;\nmy $mode = \"0644\"; chmod $mode, \"foo\";      # !!! sets mode to\n# --w----r-T\nmy $mode = \"0644\"; chmod oct($mode), \"foo\"; # this is better\nmy $mode = 0644;   chmod $mode, \"foo\";      # this is best\n\nOn systems that support fchmod(2), you may pass filehandles among the files.  On systems\nthat don't support fchmod(2), passing filehandles raises an exception.  Filehandles must\nbe passed as globs or glob references to be recognized; barewords are considered\nfilenames.\n\nopen(my $fh, \"<\", \"foo\");\nmy $perm = (stat $fh)[2] & 07777;\nchmod($perm | 0600, $fh);\n\nYou can also import the symbolic \"SI*\" constants from the \"Fcntl\" module:\n\nuse Fcntl qw( :mode );\nchmod SIRWXU|SIRGRP|SIXGRP|SIROTH|SIXOTH, @executables;\n# Identical to the chmod 0755 of the example above.\n\nPortability issues: \"chmod\" in perlport.\n\nchomp VARIABLE\nchomp( LIST )\nchomp\nThis safer version of \"chop\" removes any trailing string that corresponds to the current\nvalue of $/ (also known as $INPUTRECORDSEPARATOR in the \"English\" module).  It returns\nthe total number of characters removed from all its arguments.  It's often used to remove\nthe newline from the end of an input record when you're worried that the final record may\nbe missing its newline.  When in paragraph mode (\"$/ = ''\"), it removes all trailing\nnewlines from the string.  When in slurp mode (\"$/ = undef\") or fixed-length record mode\n($/ is a reference to an integer or the like; see perlvar), \"chomp\" won't remove\nanything.  If VARIABLE is omitted, it chomps $.  Example:\n\nwhile (<>) {\nchomp;  # avoid \\n on last field\nmy @array = split(/:/);\n# ...\n}\n\nIf VARIABLE is a hash, it chomps the hash's values, but not its keys, resetting the\n\"each\" iterator in the process.\n\nYou can actually chomp anything that's an lvalue, including an assignment:\n\nchomp(my $cwd = `pwd`);\nchomp(my $answer = <STDIN>);\n\nIf you chomp a list, each element is chomped, and the total number of characters removed\nis returned.\n\nNote that parentheses are necessary when you're chomping anything that is not a simple\nvariable.  This is because \"chomp $cwd = `pwd`;\" is interpreted as \"(chomp $cwd) =\n`pwd`;\", rather than as \"chomp( $cwd = `pwd` )\" which you might expect.  Similarly,\n\"chomp $a, $b\" is interpreted as \"chomp($a), $b\" rather than as \"chomp($a, $b)\".\n\nchop VARIABLE\nchop( LIST )\nchop\nChops off the last character of a string and returns the character chopped.  It is much\nmore efficient than \"s/.$//s\" because it neither scans nor copies the string.  If\nVARIABLE is omitted, chops $.  If VARIABLE is a hash, it chops the hash's values, but\nnot its keys, resetting the \"each\" iterator in the process.\n\nYou can actually chop anything that's an lvalue, including an assignment.\n\nIf you chop a list, each element is chopped.  Only the value of the last \"chop\" is\nreturned.\n\nNote that \"chop\" returns the last character.  To return all but the last character, use\n\"substr($string, 0, -1)\".\n\nSee also \"chomp\".\n\nchown LIST\nChanges the owner (and group) of a list of files.  The first two elements of the list\nmust be the numeric uid and gid, in that order.  A value of -1 in either position is\ninterpreted by most systems to leave that value unchanged.  Returns the number of files\nsuccessfully changed.\n\nmy $cnt = chown $uid, $gid, 'foo', 'bar';\nchown $uid, $gid, @filenames;\n\nOn systems that support fchown(2), you may pass filehandles among the files.  On systems\nthat don't support fchown(2), passing filehandles raises an exception.  Filehandles must\nbe passed as globs or glob references to be recognized; barewords are considered\nfilenames.\n\nHere's an example that looks up nonnumeric uids in the passwd file:\n\nprint \"User: \";\nchomp(my $user = <STDIN>);\nprint \"Files: \";\nchomp(my $pattern = <STDIN>);\n\nmy ($login,$pass,$uid,$gid) = getpwnam($user)\nor die \"$user not in passwd file\";\n\nmy @ary = glob($pattern);  # expand filenames\nchown $uid, $gid, @ary;\n\nOn most systems, you are not allowed to change the ownership of the file unless you're\nthe superuser, although you should be able to change the group to any of your secondary\ngroups.  On insecure systems, these restrictions may be relaxed, but this is not a\nportable assumption.  On POSIX systems, you can detect this condition this way:\n\nuse POSIX qw(sysconf PCCHOWNRESTRICTED);\nmy $canchowngiveaway = ! sysconf(PCCHOWNRESTRICTED);\n\nPortability issues: \"chown\" in perlport.\n\nchr NUMBER\nchr Returns the character represented by that NUMBER in the character set.  For example,\n\"chr(65)\" is \"A\" in either ASCII or Unicode, and chr(0x263a) is a Unicode smiley face.\n\nNegative values give the Unicode replacement character (chr(0xfffd)), except under the\nbytes pragma, where the low eight bits of the value (truncated to an integer) are used.\n\nIf NUMBER is omitted, uses $.\n\nFor the reverse, use \"ord\".\n\nNote that characters from 128 to 255 (inclusive) are by default internally not encoded as\nUTF-8 for backward compatibility reasons.\n\nSee perlunicode for more about Unicode.\n\nchroot FILENAME\nchroot\nThis function works like the system call by the same name: it makes the named directory\nthe new root directory for all further pathnames that begin with a \"/\" by your process\nand all its children.  (It doesn't change your current working directory, which is\nunaffected.)  For security reasons, this call is restricted to the superuser.  If\nFILENAME is omitted, does a \"chroot\" to $.\n\nNOTE:  It is mandatory for security to \"chdir(\"/\")\" (\"chdir\" to the root directory)\nimmediately after a \"chroot\", otherwise the current working directory may be outside of\nthe new root.\n\nPortability issues: \"chroot\" in perlport.\n\nclose FILEHANDLE\nclose\nCloses the file or pipe associated with the filehandle, flushes the IO buffers, and\ncloses the system file descriptor.  Returns true if those operations succeed and if no\nerror was reported by any PerlIO layer.  Closes the currently selected filehandle if the\nargument is omitted.\n\nYou don't have to close FILEHANDLE if you are immediately going to do another \"open\" on\nit, because \"open\" closes it for you.  (See \"open\".) However, an explicit \"close\" on an\ninput file resets the line counter ($.), while the implicit close done by \"open\" does\nnot.\n\nIf the filehandle came from a piped open, \"close\" returns false if one of the other\nsyscalls involved fails or if its program exits with non-zero status.  If the only\nproblem was that the program exited non-zero, $! will be set to 0.  Closing a pipe also\nwaits for the process executing on the pipe to exit--in case you wish to look at the\noutput of the pipe afterwards--and implicitly puts the exit status value of that command\ninto $? and \"${^CHILDERRORNATIVE}\".\n\nIf there are multiple threads running, \"close\" on a filehandle from a piped open returns\ntrue without waiting for the child process to terminate, if the filehandle is still open\nin another thread.\n\nClosing the read end of a pipe before the process writing to it at the other end is done\nwriting results in the writer receiving a SIGPIPE.  If the other end can't handle that,\nbe sure to read all the data before closing the pipe.\n\nExample:\n\nopen(OUTPUT, '|sort >foo')  # pipe to sort\nor die \"Can't start sort: $!\";\n#...                        # print stuff to output\nclose OUTPUT                # wait for sort to finish\nor warn $! ? \"Error closing sort pipe: $!\"\n: \"Exit status $? from sort\";\nopen(INPUT, 'foo')          # get sort's results\nor die \"Can't open 'foo' for input: $!\";\n\nFILEHANDLE may be an expression whose value can be used as an indirect filehandle,\nusually the real filehandle name or an autovivified handle.\n\nclosedir DIRHANDLE\nCloses a directory opened by \"opendir\" and returns the success of that system call.\n\nconnect SOCKET,NAME\nAttempts to connect to a remote socket, just like connect(2).  Returns true if it\nsucceeded, false otherwise.  NAME should be a packed address of the appropriate type for\nthe socket.  See the examples in \"Sockets: Client/Server Communication\" in perlipc.\n\ncontinue BLOCK\ncontinue\nWhen followed by a BLOCK, \"continue\" is actually a flow control statement rather than a\nfunction.  If there is a \"continue\" BLOCK attached to a BLOCK (typically in a \"while\" or\n\"foreach\"), it is always executed just before the conditional is about to be evaluated\nagain, just like the third part of a \"for\" loop in C.  Thus it can be used to increment a\nloop variable, even when the loop has been continued via the \"next\" statement (which is\nsimilar to the C \"continue\" statement).\n\n\"last\", \"next\", or \"redo\" may appear within a \"continue\" block; \"last\" and \"redo\" behave\nas if they had been executed within the main block.  So will \"next\", but since it will\nexecute a \"continue\" block, it may be more entertaining.\n\nwhile (EXPR) {\n### redo always comes here\ndosomething;\n} continue {\n### next always comes here\ndosomethingelse;\n# then back the top to re-check EXPR\n}\n### last always comes here\n\nOmitting the \"continue\" section is equivalent to using an empty one, logically enough, so\n\"next\" goes directly back to check the condition at the top of the loop.\n\nWhen there is no BLOCK, \"continue\" is a function that falls through the current \"when\" or\n\"default\" block instead of iterating a dynamically enclosing \"foreach\" or exiting a\nlexically enclosing \"given\".  In Perl 5.14 and earlier, this form of \"continue\" was only\navailable when the \"switch\" feature was enabled.  See feature and \"Switch Statements\" in\nperlsyn for more information.\n\ncos EXPR\ncos Returns the cosine of EXPR (expressed in radians).  If EXPR is omitted, takes the cosine\nof $.\n\nFor the inverse cosine operation, you may use the \"Math::Trig::acos\" function, or use\nthis relation:\n\nsub acos { atan2( sqrt(1 - $[0] * $[0]), $[0] ) }\n\ncrypt PLAINTEXT,SALT\nCreates a digest string exactly like the crypt(3) function in the C library (assuming\nthat you actually have a version there that has not been extirpated as a potential\nmunition).\n\n\"crypt\" is a one-way hash function.  The PLAINTEXT and SALT are turned into a short\nstring, called a digest, which is returned.  The same PLAINTEXT and SALT will always\nreturn the same string, but there is no (known) way to get the original PLAINTEXT from\nthe hash.  Small changes in the PLAINTEXT or SALT will result in large changes in the\ndigest.\n\nThere is no decrypt function.  This function isn't all that useful for cryptography (for\nthat, look for Crypt modules on your nearby CPAN mirror) and the name \"crypt\" is a bit of\na misnomer.  Instead it is primarily used to check if two pieces of text are the same\nwithout having to transmit or store the text itself.  An example is checking if a correct\npassword is given.  The digest of the password is stored, not the password itself.  The\nuser types in a password that is \"crypt\"'d with the same salt as the stored digest.  If\nthe two digests match, the password is correct.\n\nWhen verifying an existing digest string you should use the digest as the salt (like\n\"crypt($plain, $digest) eq $digest\").  The SALT used to create the digest is visible as\npart of the digest.  This ensures \"crypt\" will hash the new string with the same salt as\nthe digest.  This allows your code to work with the standard \"crypt\" and with more exotic\nimplementations.  In other words, assume nothing about the returned string itself nor\nabout how many bytes of SALT may matter.\n\nTraditionally the result is a string of 13 bytes: two first bytes of the salt, followed\nby 11 bytes from the set \"[./0-9A-Za-z]\", and only the first eight bytes of PLAINTEXT\nmattered.  But alternative hashing schemes (like MD5), higher level security schemes\n(like C2), and implementations on non-Unix platforms may produce different strings.\n\nWhen choosing a new salt create a random two character string whose characters come from\nthe set \"[./0-9A-Za-z]\" (like \"join '', ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64,\nrand 64]\").  This set of characters is just a recommendation; the characters allowed in\nthe salt depend solely on your system's crypt library, and Perl can't restrict what salts\n\"crypt\" accepts.\n\nHere's an example that makes sure that whoever runs this program knows their password:\n\nmy $pwd = (getpwuid($<))[1];\n\nsystem \"stty -echo\";\nprint \"Password: \";\nchomp(my $word = <STDIN>);\nprint \"\\n\";\nsystem \"stty echo\";\n\nif (crypt($word, $pwd) ne $pwd) {\ndie \"Sorry...\\n\";\n} else {\nprint \"ok\\n\";\n}\n\nOf course, typing in your own password to whoever asks you for it is unwise.\n\nThe \"crypt\" function is unsuitable for hashing large quantities of data, not least of all\nbecause you can't get the information back.  Look at the Digest module for more robust\nalgorithms.\n\nIf using \"crypt\" on a Unicode string (which potentially has characters with codepoints\nabove 255), Perl tries to make sense of the situation by trying to downgrade (a copy of)\nthe string back to an eight-bit byte string before calling \"crypt\" (on that copy).  If\nthat works, good.  If not, \"crypt\" dies with \"Wide character in crypt\".\n\nPortability issues: \"crypt\" in perlport.\n\ndbmclose HASH\n[This function has been largely superseded by the \"untie\" function.]\n\nBreaks the binding between a DBM file and a hash.\n\nPortability issues: \"dbmclose\" in perlport.\n\ndbmopen HASH,DBNAME,MASK\n[This function has been largely superseded by the \"tie\" function.]\n\nThis binds a dbm(3), ndbm(3), sdbm(3), gdbm(3), or Berkeley DB file to a hash.  HASH is\nthe name of the hash.  (Unlike normal \"open\", the first argument is not a filehandle,\neven though it looks like one).  DBNAME is the name of the database (without the .dir or\n.pag extension if any).  If the database does not exist, it is created with protection\nspecified by MASK (as modified by the \"umask\").  To prevent creation of the database if\nit doesn't exist, you may specify a MODE of 0, and the function will return a false value\nif it can't find an existing database.  If your system supports only the older DBM\nfunctions, you may make only one \"dbmopen\" call in your program.  In older versions of\nPerl, if your system had neither DBM nor ndbm, calling \"dbmopen\" produced a fatal error;\nit now falls back to sdbm(3).\n\nIf you don't have write access to the DBM file, you can only read hash variables, not set\nthem.  If you want to test whether you can write, either use file tests or try setting a\ndummy hash entry inside an \"eval\" to trap the error.\n\nNote that functions such as \"keys\" and \"values\" may return huge lists when used on large\nDBM files.  You may prefer to use the \"each\" function to iterate over large DBM files.\nExample:\n\n# print out history file offsets\ndbmopen(%HIST,'/usr/lib/news/history',0666);\nwhile (($key,$val) = each %HIST) {\nprint $key, ' = ', unpack('L',$val), \"\\n\";\n}\ndbmclose(%HIST);\n\nSee also AnyDBMFile for a more general description of the pros and cons of the various\ndbm approaches, as well as DBFile for a particularly rich implementation.\n\nYou can control which DBM library you use by loading that library before you call\n\"dbmopen\":\n\nuse DBFile;\ndbmopen(%NSHist, \"$ENV{HOME}/.netscape/history.db\")\nor die \"Can't open netscape history file: $!\";\n\nPortability issues: \"dbmopen\" in perlport.\n\ndefined EXPR\ndefined\nReturns a Boolean value telling whether EXPR has a value other than the undefined value\n\"undef\".  If EXPR is not present, $ is checked.\n\nMany operations return \"undef\" to indicate failure, end of file, system error,\nuninitialized variable, and other exceptional conditions.  This function allows you to\ndistinguish \"undef\" from other values.  (A simple Boolean test will not distinguish among\n\"undef\", zero, the empty string, and \"0\", which are all equally false.)  Note that since\n\"undef\" is a valid scalar, its presence doesn't necessarily indicate an exceptional\ncondition: \"pop\" returns \"undef\" when its argument is an empty array, or when the element\nto return happens to be \"undef\".\n\nYou may also use \"defined(&func)\" to check whether subroutine \"func\" has ever been\ndefined.  The return value is unaffected by any forward declarations of \"func\".  A\nsubroutine that is not defined may still be callable: its package may have an \"AUTOLOAD\"\nmethod that makes it spring into existence the first time that it is called; see perlsub.\n\nUse of \"defined\" on aggregates (hashes and arrays) is no longer supported. It used to\nreport whether memory for that aggregate had ever been allocated.  You should instead use\na simple test for size:\n\nif (@anarray) { print \"has array elements\\n\" }\nif (%ahash)   { print \"has hash members\\n\"   }\n\nWhen used on a hash element, it tells you whether the value is defined, not whether the\nkey exists in the hash.  Use \"exists\" for the latter purpose.\n\nExamples:\n\nprint if defined $switch{D};\nprint \"$val\\n\" while defined($val = pop(@ary));\ndie \"Can't readlink $sym: $!\"\nunless defined($value = readlink $sym);\nsub foo { defined &$bar ? $bar->(@) : die \"No bar\"; }\n$debugging = 0 unless defined $debugging;\n\nNote:  Many folks tend to overuse \"defined\" and are then surprised to discover that the\nnumber 0 and \"\" (the zero-length string) are, in fact, defined values.  For example, if\nyou say\n\n\"ab\" =~ /a(.*)b/;\n\nThe pattern match succeeds and $1 is defined, although it matched \"nothing\".  It didn't\nreally fail to match anything.  Rather, it matched something that happened to be zero\ncharacters long.  This is all very above-board and honest.  When a function returns an\nundefined value, it's an admission that it couldn't give you an honest answer.  So you\nshould use \"defined\" only when questioning the integrity of what you're trying to do.  At\nother times, a simple comparison to 0 or \"\" is what you want.\n\nSee also \"undef\", \"exists\", \"ref\".\n\ndelete EXPR\nGiven an expression that specifies an element or slice of a hash, \"delete\" deletes the\nspecified elements from that hash so that \"exists\" on that element no longer returns\ntrue.  Setting a hash element to the undefined value does not remove its key, but\ndeleting it does; see \"exists\".\n\nIn list context, usually returns the value or values deleted, or the last such element in\nscalar context.  The return list's length corresponds to that of the argument list:\ndeleting non-existent elements returns the undefined value in their corresponding\npositions. When a key/value hash slice is passed to \"delete\", the return value is a list\nof key/value pairs (two elements for each item deleted from the hash).\n\n\"delete\" may also be used on arrays and array slices, but its behavior is less\nstraightforward.  Although \"exists\" will return false for deleted entries, deleting array\nelements never changes indices of existing values; use \"shift\" or \"splice\" for that.\nHowever, if any deleted elements fall at the end of an array, the array's size shrinks to\nthe position of the highest element that still tests true for \"exists\", or to 0 if none\ndo.  In other words, an array won't have trailing nonexistent elements after a delete.\n\nWARNING: Calling \"delete\" on array values is strongly discouraged.  The notion of\ndeleting or checking the existence of Perl array elements is not conceptually coherent,\nand can lead to surprising behavior.\n\nDeleting from %ENV modifies the environment.  Deleting from a hash tied to a DBM file\ndeletes the entry from the DBM file.  Deleting from a \"tied\" hash or array may not\nnecessarily return anything; it depends on the implementation of the \"tied\" package's\nDELETE method, which may do whatever it pleases.\n\nThe \"delete local EXPR\" construct localizes the deletion to the current block at run\ntime.  Until the block exits, elements locally deleted temporarily no longer exist.  See\n\"Localized deletion of elements of composite types\" in perlsub.\n\nmy %hash = (foo => 11, bar => 22, baz => 33);\nmy $scalar = delete $hash{foo};         # $scalar is 11\n$scalar = delete @hash{qw(foo bar)}; # $scalar is 22\nmy @array  = delete @hash{qw(foo baz)}; # @array  is (undef,33)\n\nThe following (inefficiently) deletes all the values of %HASH and @ARRAY:\n\nforeach my $key (keys %HASH) {\ndelete $HASH{$key};\n}\n\nforeach my $index (0 .. $#ARRAY) {\ndelete $ARRAY[$index];\n}\n\nAnd so do these:\n\ndelete @HASH{keys %HASH};\n\ndelete @ARRAY[0 .. $#ARRAY];\n\nBut both are slower than assigning the empty list or undefining %HASH or @ARRAY, which is\nthe customary way to empty out an aggregate:\n\n%HASH = ();     # completely empty %HASH\nundef %HASH;    # forget %HASH ever existed\n\n@ARRAY = ();    # completely empty @ARRAY\nundef @ARRAY;   # forget @ARRAY ever existed\n\nThe EXPR can be arbitrarily complicated provided its final operation is an element or\nslice of an aggregate:\n\ndelete $ref->[$x][$y]{$key};\ndelete $ref->[$x][$y]->@{$key1, $key2, @morekeys};\n\ndelete $ref->[$x][$y][$index];\ndelete $ref->[$x][$y]->@[$index1, $index2, @moreindices];\n\ndie LIST\n\"die\" raises an exception.  Inside an \"eval\" the exception is stuffed into $@ and the\n\"eval\" is terminated with the undefined value.  If the exception is outside of all\nenclosing \"eval\"s, then the uncaught exception is printed to \"STDERR\" and perl exits with\nan exit code indicating failure.  If you need to exit the process with a specific exit\ncode, see \"exit\".\n\nEquivalent examples:\n\ndie \"Can't cd to spool: $!\\n\" unless chdir '/usr/spool/news';\nchdir '/usr/spool/news' or die \"Can't cd to spool: $!\\n\"\n\nMost of the time, \"die\" is called with a string to use as the exception.  You may either\ngive a single non-reference operand to serve as the exception, or a list of two or more\nitems, which will be stringified and concatenated to make the exception.\n\nIf the string exception does not end in a newline, the current script line number and\ninput line number (if any) and a newline are appended to it.  Note that the \"input line\nnumber\" (also known as \"chunk\") is subject to whatever notion of \"line\" happens to be\ncurrently in effect, and is also available as the special variable $..  See \"$/\" in\nperlvar and \"$.\" in perlvar.\n\nHint: sometimes appending \", stopped\" to your message will cause it to make better sense\nwhen the string \"at foo line 123\" is appended.  Suppose you are running script \"canasta\".\n\ndie \"/etc/games is no good\";\ndie \"/etc/games is no good, stopped\";\n\nproduce, respectively\n\n/etc/games is no good at canasta line 123.\n/etc/games is no good, stopped at canasta line 123.\n\nIf LIST was empty or made an empty string, and $@ already contains an exception value\n(typically from a previous \"eval\"), then that value is reused after appending\n\"\\t...propagated\".  This is useful for propagating exceptions:\n\neval { ... };\ndie unless $@ =~ /Expected exception/;\n\nIf LIST was empty or made an empty string, and $@ contains an object reference that has a\n\"PROPAGATE\" method, that method will be called with additional file and line number\nparameters.  The return value replaces the value in $@;  i.e., as if \"$@ = eval {\n$@->PROPAGATE(FILE, LINE) };\" were called.\n\nIf LIST was empty or made an empty string, and $@ is also empty, then the string \"Died\"\nis used.\n\nYou can also call \"die\" with a reference argument, and if this is trapped within an\n\"eval\", $@ contains that reference.  This permits more elaborate exception handling using\nobjects that maintain arbitrary state about the exception.  Such a scheme is sometimes\npreferable to matching particular string values of $@ with regular expressions.\n\nBecause Perl stringifies uncaught exception messages before display, you'll probably want\nto overload stringification operations on exception objects.  See overload for details\nabout that.  The stringified message should be non-empty, and should end in a newline, in\norder to fit in with the treatment of string exceptions.  Also, because an exception\nobject reference cannot be stringified without destroying it, Perl doesn't attempt to\nappend location or other information to a reference exception.  If you want location\ninformation with a complex exception object, you'll have to arrange to put the location\ninformation into the object yourself.\n\nBecause $@ is a global variable, be careful that analyzing an exception caught by \"eval\"\ndoesn't replace the reference in the global variable.  It's easiest to make a local copy\nof the reference before any manipulations.  Here's an example:\n\nuse Scalar::Util \"blessed\";\n\neval { ... ; die Some::Module::Exception->new( FOO => \"bar\" ) };\nif (my $everr = $@) {\nif (blessed($everr)\n&& $everr->isa(\"Some::Module::Exception\")) {\n# handle Some::Module::Exception\n}\nelse {\n# handle all other possible exceptions\n}\n}\n\nIf an uncaught exception results in interpreter exit, the exit code is determined from\nthe values of $! and $? with this pseudocode:\n\nexit $! if $!;              # errno\nexit $? >> 8 if $? >> 8;    # child exit status\nexit 255;                   # last resort\n\nAs with \"exit\", $? is set prior to unwinding the call stack; any \"DESTROY\" or \"END\"\nhandlers can then alter this value, and thus Perl's exit code.\n\nThe intent is to squeeze as much possible information about the likely cause into the\nlimited space of the system exit code.  However, as $! is the value of C's \"errno\", which\ncan be set by any system call, this means that the value of the exit code used by \"die\"\ncan be non-predictable, so should not be relied upon, other than to be non-zero.\n\nYou can arrange for a callback to be run just before the \"die\" does its deed, by setting\nthe $SIG{DIE} hook.  The associated handler is called with the exception as an\nargument, and can change the exception, if it sees fit, by calling \"die\" again.  See\n\"%SIG\" in perlvar for details on setting %SIG entries, and \"eval\" for some examples.\nAlthough this feature was to be run only right before your program was to exit, this is\nnot currently so: the $SIG{DIE} hook is currently called even inside \"eval\"ed\nblocks/strings!  If one wants the hook to do nothing in such situations, put\n\ndie @ if $^S;\n\nas the first line of the handler (see \"$^S\" in perlvar).  Because this promotes strange\naction at a distance, this counterintuitive behavior may be fixed in a future release.\n\nSee also \"exit\", \"warn\", and the Carp module.\n\ndo BLOCK\nNot really a function.  Returns the value of the last command in the sequence of commands\nindicated by BLOCK.  When modified by the \"while\" or \"until\" loop modifier, executes the\nBLOCK once before testing the loop condition.  (On other statements the loop modifiers\ntest the conditional first.)\n\n\"do BLOCK\" does not count as a loop, so the loop control statements \"next\", \"last\", or\n\"redo\" cannot be used to leave or restart the block.  See perlsyn for alternative\nstrategies.\n\ndo EXPR\nUses the value of EXPR as a filename and executes the contents of the file as a Perl\nscript:\n\n# load the exact specified file (./ and ../ special-cased)\ndo '/foo/stat.pl';\ndo './stat.pl';\ndo '../foo/stat.pl';\n\n# search for the named file within @INC\ndo 'stat.pl';\ndo 'foo/stat.pl';\n\n\"do './stat.pl'\" is largely like\n\neval `cat stat.pl`;\n\nexcept that it's more concise, runs no external processes, and keeps track of the current\nfilename for error messages. It also differs in that code evaluated with \"do FILE\" cannot\nsee lexicals in the enclosing scope; \"eval STRING\" does.  It's the same, however, in that\nit does reparse the file every time you call it, so you probably don't want to do this\ninside a loop.\n\nUsing \"do\" with a relative path (except for ./ and ../), like\n\ndo 'foo/stat.pl';\n\nwill search the @INC directories, and update %INC if the file is found.  See \"@INC\" in\nperlvar and \"%INC\" in perlvar for these variables. In particular, note that whilst\nhistorically @INC contained '.' (the current directory) making these two cases\nequivalent, that is no longer necessarily the case, as '.' is not included in @INC by\ndefault in perl versions 5.26.0 onwards. Instead, perl will now warn:\n\ndo \"stat.pl\" failed, '.' is no longer in @INC;\ndid you mean do \"./stat.pl\"?\n\nIf \"do\" can read the file but cannot compile it, it returns \"undef\" and sets an error\nmessage in $@.  If \"do\" cannot read the file, it returns undef and sets $! to the error.\nAlways check $@ first, as compilation could fail in a way that also sets $!.  If the file\nis successfully compiled, \"do\" returns the value of the last expression evaluated.\n\nInclusion of library modules is better done with the \"use\" and \"require\" operators, which\nalso do automatic error checking and raise an exception if there's a problem.\n\nYou might like to use \"do\" to read in a program configuration file.  Manual error\nchecking can be done this way:\n\n# Read in config files: system first, then user.\n# Beware of using relative pathnames here.\nfor $file (\"/share/prog/defaults.rc\",\n\"$ENV{HOME}/.someprogrc\")\n{\nunless ($return = do $file) {\nwarn \"couldn't parse $file: $@\" if $@;\nwarn \"couldn't do $file: $!\"    unless defined $return;\nwarn \"couldn't run $file\"       unless $return;\n}\n}\n\ndump LABEL\ndump EXPR\ndump\nThis function causes an immediate core dump.  See also the -u command-line switch in\nperlrun, which does the same thing.  Primarily this is so that you can use the undump\nprogram (not supplied) to turn your core dump into an executable binary after having\ninitialized all your variables at the beginning of the program.  When the new binary is\nexecuted it will begin by executing a \"goto LABEL\" (with all the restrictions that \"goto\"\nsuffers).  Think of it as a goto with an intervening core dump and reincarnation.  If\n\"LABEL\" is omitted, restarts the program from the top.  The \"dump EXPR\" form, available\nstarting in Perl 5.18.0, allows a name to be computed at run time, being otherwise\nidentical to \"dump LABEL\".\n\nWARNING: Any files opened at the time of the dump will not be open any more when the\nprogram is reincarnated, with possible resulting confusion by Perl.\n\nThis function is now largely obsolete, mostly because it's very hard to convert a core\nfile into an executable.  As of Perl 5.30, it must be invoked as \"CORE::dump()\".\n\nUnlike most named operators, this has the same precedence as assignment.  It is also\nexempt from the looks-like-a-function rule, so \"dump (\"foo\").\"bar\"\" will cause \"bar\" to\nbe part of the argument to \"dump\".\n\nPortability issues: \"dump\" in perlport.\n\neach HASH\neach ARRAY\nWhen called on a hash in list context, returns a 2-element list consisting of the key and\nvalue for the next element of a hash.  In Perl 5.12 and later only, it will also return\nthe index and value for the next element of an array so that you can iterate over it;\nolder Perls consider this a syntax error.  When called in scalar context, returns only\nthe key (not the value) in a hash, or the index in an array.\n\nHash entries are returned in an apparently random order.  The actual random order is\nspecific to a given hash; the exact same series of operations on two hashes may result in\na different order for each hash.  Any insertion into the hash may change the order, as\nwill any deletion, with the exception that the most recent key returned by \"each\" or\n\"keys\" may be deleted without changing the order.  So long as a given hash is unmodified\nyou may rely on \"keys\", \"values\" and \"each\" to repeatedly return the same order as each\nother.  See \"Algorithmic Complexity Attacks\" in perlsec for details on why hash order is\nrandomized.  Aside from the guarantees provided here the exact details of Perl's hash\nalgorithm and the hash traversal order are subject to change in any release of Perl.\n\nAfter \"each\" has returned all entries from the hash or array, the next call to \"each\"\nreturns the empty list in list context and \"undef\" in scalar context; the next call\nfollowing that one restarts iteration.  Each hash or array has its own internal iterator,\naccessed by \"each\", \"keys\", and \"values\".  The iterator is implicitly reset when \"each\"\nhas reached the end as just described; it can be explicitly reset by calling \"keys\" or\n\"values\" on the hash or array, or by referencing the hash (but not array) in list\ncontext.  If you add or delete a hash's elements while iterating over it, the effect on\nthe iterator is unspecified; for example, entries may be skipped or duplicated--so don't\ndo that.  Exception: It is always safe to delete the item most recently returned by\n\"each\", so the following code works properly:\n\nwhile (my ($key, $value) = each %hash) {\nprint $key, \"\\n\";\ndelete $hash{$key};   # This is safe\n}\n\nTied hashes may have a different ordering behaviour to perl's hash implementation.\n\nThe iterator used by \"each\" is attached to the hash or array, and is shared between all\niteration operations applied to the same hash or array.  Thus all uses of \"each\" on a\nsingle hash or array advance the same iterator location.  All uses of \"each\" are also\nsubject to having the iterator reset by any use of \"keys\" or \"values\" on the same hash or\narray, or by the hash (but not array) being referenced in list context.  This makes\n\"each\"-based loops quite fragile: it is easy to arrive at such a loop with the iterator\nalready part way through the object, or to accidentally clobber the iterator state during\nexecution of the loop body.  It's easy enough to explicitly reset the iterator before\nstarting a loop, but there is no way to insulate the iterator state used by a loop from\nthe iterator state used by anything else that might execute during the loop body.  To\navoid these problems, use a \"foreach\" loop rather than \"while\"-\"each\".\n\nThis prints out your environment like the printenv(1) program, but in a different order:\n\nwhile (my ($key,$value) = each %ENV) {\nprint \"$key=$value\\n\";\n}\n\nStarting with Perl 5.14, an experimental feature allowed \"each\" to take a scalar\nexpression. This experiment has been deemed unsuccessful, and was removed as of Perl\n5.24.\n\nAs of Perl 5.18 you can use a bare \"each\" in a \"while\" loop, which will set $ on every\niteration.  If either an \"each\" expression or an explicit assignment of an \"each\"\nexpression to a scalar is used as a \"while\"/\"for\" condition, then the condition actually\ntests for definedness of the expression's value, not for its regular truth value.\n\nwhile (each %ENV) {\nprint \"$=$ENV{$}\\n\";\n}\n\nTo avoid confusing would-be users of your code who are running earlier versions of Perl\nwith mysterious syntax errors, put this sort of thing at the top of your file to signal\nthat your code will work only on Perls of a recent vintage:\n\nuse 5.012;  # so keys/values/each work on arrays\nuse 5.018;  # so each assigns to $ in a lone while test\n\nSee also \"keys\", \"values\", and \"sort\".\n\neof FILEHANDLE\neof ()\neof Returns 1 if the next read on FILEHANDLE will return end of file or if FILEHANDLE is not\nopen.  FILEHANDLE may be an expression whose value gives the real filehandle.  (Note that\nthis function actually reads a character and then \"ungetc\"s it, so isn't useful in an\ninteractive context.)  Do not read from a terminal file (or call \"eof(FILEHANDLE)\" on it)\nafter end-of-file is reached.  File types such as terminals may lose the end-of-file\ncondition if you do.\n\nAn \"eof\" without an argument uses the last file read.  Using \"eof()\" with empty\nparentheses is different.  It refers to the pseudo file formed from the files listed on\nthe command line and accessed via the \"<>\" operator.  Since \"<>\" isn't explicitly opened,\nas a normal filehandle is, an \"eof()\" before \"<>\" has been used will cause @ARGV to be\nexamined to determine if input is available.   Similarly, an \"eof()\" after \"<>\" has\nreturned end-of-file will assume you are processing another @ARGV list, and if you\nhaven't set @ARGV, will read input from \"STDIN\"; see \"I/O Operators\" in perlop.\n\nIn a \"while (<>)\" loop, \"eof\" or \"eof(ARGV)\" can be used to detect the end of each file,\nwhereas \"eof()\" will detect the end of the very last file only.  Examples:\n\n# reset line numbering on each input file\nwhile (<>) {\nnext if /^\\s*#/;  # skip comments\nprint \"$.\\t$\";\n} continue {\nclose ARGV if eof;  # Not eof()!\n}\n\n# insert dashes just before last line of last file\nwhile (<>) {\nif (eof()) {  # check for end of last file\nprint \"--------------\\n\";\n}\nprint;\nlast if eof();     # needed if we're reading from a terminal\n}\n\nPractical hint: you almost never need to use \"eof\" in Perl, because the input operators\ntypically return \"undef\" when they run out of data or encounter an error.\n\neval EXPR\neval BLOCK\neval\n\"eval\" in all its forms is used to execute a little Perl program, trapping any errors\nencountered so they don't crash the calling program.\n\nPlain \"eval\" with no argument is just \"eval EXPR\", where the expression is understood to\nbe contained in $.  Thus there are only two real \"eval\" forms; the one with an EXPR is\noften called \"string eval\".  In a string eval, the value of the expression (which is\nitself determined within scalar context) is first parsed, and if there were no errors,\nexecuted as a block within the lexical context of the current Perl program.  This form is\ntypically used to delay parsing and subsequent execution of the text of EXPR until run\ntime.  Note that the value is parsed every time the \"eval\" executes.\n\nThe other form is called \"block eval\".  It is less general than string eval, but the code\nwithin the BLOCK is parsed only once (at the same time the code surrounding the \"eval\"\nitself was parsed) and executed within the context of the current Perl program.  This\nform is typically used to trap exceptions more efficiently than the first, while also\nproviding the benefit of checking the code within BLOCK at compile time.  BLOCK is parsed\nand compiled just once.  Since errors are trapped, it often is used to check if a given\nfeature is available.\n\nIn both forms, the value returned is the value of the last expression evaluated inside\nthe mini-program; a return statement may also be used, just as with subroutines.  The\nexpression providing the return value is evaluated in void, scalar, or list context,\ndepending on the context of the \"eval\" itself.  See \"wantarray\" for more on how the\nevaluation context can be determined.\n\nIf there is a syntax error or runtime error, or a \"die\" statement is executed, \"eval\"\nreturns \"undef\" in scalar context, or an empty list in list context, and $@ is set to the\nerror message.  (Prior to 5.16, a bug caused \"undef\" to be returned in list context for\nsyntax errors, but not for runtime errors.) If there was no error, $@ is set to the empty\nstring.  A control flow operator like \"last\" or \"goto\" can bypass the setting of $@.\nBeware that using \"eval\" neither silences Perl from printing warnings to STDERR, nor does\nit stuff the text of warning messages into $@.  To do either of those, you have to use\nthe $SIG{WARN} facility, or turn off warnings inside the BLOCK or EXPR using\n\"no warnings 'all'\".  See \"warn\", perlvar, and warnings.\n\nNote that, because \"eval\" traps otherwise-fatal errors, it is useful for determining\nwhether a particular feature (such as \"socket\" or \"symlink\") is implemented.  It is also\nPerl's exception-trapping mechanism, where the \"die\" operator is used to raise\nexceptions.\n\nBefore Perl 5.14, the assignment to $@ occurred before restoration of localized\nvariables, which means that for your code to run on older versions, a temporary is\nrequired if you want to mask some, but not all errors:\n\n# alter $@ on nefarious repugnancy only\n{\nmy $e;\n{\nlocal $@; # protect existing $@\neval { testrepugnancy() };\n# $@ =~ /nefarious/ and die $@; # Perl 5.14 and higher only\n$@ =~ /nefarious/ and $e = $@;\n}\ndie $e if defined $e\n}\n\nThere are some different considerations for each form:\n\nString eval\nSince the return value of EXPR is executed as a block within the lexical context of\nthe current Perl program, any outer lexical variables are visible to it, and any\npackage variable settings or subroutine and format definitions remain afterwards.\n\nUnder the \"unicodeeval\" feature\nIf this feature is enabled (which is the default under a \"use 5.16\" or higher\ndeclaration), EXPR is considered to be in the same encoding as the surrounding\nprogram.  Thus if \"use utf8\" is in effect, the string will be treated as being\nUTF-8 encoded.  Otherwise, the string is considered to be a sequence of\nindependent bytes.  Bytes that correspond to ASCII-range code points will have\ntheir normal meanings for operators in the string.  The treatment of the other\nbytes depends on if the \"'unicodestrings\"\" feature is in effect.\n\nIn a plain \"eval\" without an EXPR argument, being in \"use utf8\" or not is\nirrelevant; the UTF-8ness of $ itself determines the behavior.\n\nAny \"use utf8\" or \"no utf8\" declarations within the string have no effect, and\nsource filters are forbidden.  (\"unicodestrings\", however, can appear within the\nstring.)  See also the \"evalbytes\" operator, which works properly with source\nfilters.\n\nVariables defined outside the \"eval\" and used inside it retain their original\nUTF-8ness.  Everything inside the string follows the normal rules for a Perl\nprogram with the given state of \"use utf8\".\n\nOutside the \"unicodeeval\" feature\nIn this case, the behavior is problematic and is not so easily described.  Here\nare two bugs that cannot easily be fixed without breaking existing programs:\n\n•   It can lose track of whether something should be encoded as UTF-8 or not.\n\n•   Source filters activated within \"eval\" leak out into whichever file scope is\ncurrently being compiled.  To give an example with the CPAN module\nSemi::Semicolons:\n\nBEGIN { eval \"use Semi::Semicolons; # not filtered\" }\n# filtered here!\n\n\"evalbytes\" fixes that to work the way one would expect:\n\nuse feature \"evalbytes\";\nBEGIN { evalbytes \"use Semi::Semicolons; # filtered\" }\n# not filtered\n\nProblems can arise if the string expands a scalar containing a floating point number.\nThat scalar can expand to letters, such as \"NaN\" or \"Infinity\"; or, within the scope\nof a \"use locale\", the decimal point character may be something other than a dot\n(such as a comma).  None of these are likely to parse as you are likely expecting.\n\nYou should be especially careful to remember what's being looked at when:\n\neval $x;        # CASE 1\neval \"$x\";      # CASE 2\n\neval '$x';      # CASE 3\neval { $x };    # CASE 4\n\neval \"\\$$x++\";  # CASE 5\n$$x++;          # CASE 6\n\nCases 1 and 2 above behave identically: they run the code contained in the variable\n$x.  (Although case 2 has misleading double quotes making the reader wonder what else\nmight be happening (nothing is).)  Cases 3 and 4 likewise behave in the same way:\nthey run the code '$x', which does nothing but return the value of $x.  (Case 4 is\npreferred for purely visual reasons, but it also has the advantage of compiling at\ncompile-time instead of at run-time.)  Case 5 is a place where normally you would\nlike to use double quotes, except that in this particular situation, you can just use\nsymbolic references instead, as in case 6.\n\nAn \"eval ''\" executed within a subroutine defined in the \"DB\" package doesn't see the\nusual surrounding lexical scope, but rather the scope of the first non-DB piece of\ncode that called it.  You don't normally need to worry about this unless you are\nwriting a Perl debugger.\n\nThe final semicolon, if any, may be omitted from the value of EXPR.\n\nBlock eval\nIf the code to be executed doesn't vary, you may use the eval-BLOCK form to trap run-\ntime errors without incurring the penalty of recompiling each time.  The error, if\nany, is still returned in $@.  Examples:\n\n# make divide-by-zero nonfatal\neval { $answer = $a / $b; }; warn $@ if $@;\n\n# same thing, but less efficient\neval '$answer = $a / $b'; warn $@ if $@;\n\n# a compile-time error\neval { $answer = }; # WRONG\n\n# a run-time error\neval '$answer =';   # sets $@\n\nIf you want to trap errors when loading an XS module, some problems with the binary\ninterface (such as Perl version skew) may be fatal even with \"eval\" unless\n$ENV{PERLDLNONLAZY} is set.  See perlrun.\n\nUsing the \"eval {}\" form as an exception trap in libraries does have some issues.\nDue to the current arguably broken state of \"DIE\" hooks, you may wish not to\ntrigger any \"DIE\" hooks that user code may have installed.  You can use the\n\"local $SIG{DIE}\" construct for this purpose, as this example shows:\n\n# a private exception trap for divide-by-zero\neval { local $SIG{'DIE'}; $answer = $a / $b; };\nwarn $@ if $@;\n\nThis is especially significant, given that \"DIE\" hooks can call \"die\" again,\nwhich has the effect of changing their error messages:\n\n# DIE hooks may modify error messages\n{\nlocal $SIG{'DIE'} =\nsub { (my $x = $[0]) =~ s/foo/bar/g; die $x };\neval { die \"foo lives here\" };\nprint $@ if $@;                # prints \"bar lives here\"\n}\n\nBecause this promotes action at a distance, this counterintuitive behavior may be\nfixed in a future release.\n\n\"eval BLOCK\" does not count as a loop, so the loop control statements \"next\", \"last\",\nor \"redo\" cannot be used to leave or restart the block.\n\nThe final semicolon, if any, may be omitted from within the BLOCK.\n\nevalbytes EXPR\nevalbytes\nThis function is similar to a string eval, except it always parses its argument (or $ if\nEXPR is omitted) as a string of independent bytes.\n\nIf called when \"use utf8\" is in effect, the string will be assumed to be encoded in\nUTF-8, and \"evalbytes\" will make a temporary copy to work from, downgraded to non-UTF-8.\nIf this is not possible (because one or more characters in it require UTF-8), the\n\"evalbytes\" will fail with the error stored in $@.\n\nBytes that correspond to ASCII-range code points will have their normal meanings for\noperators in the string.  The treatment of the other bytes depends on if the\n\"'unicodestrings\"\" feature is in effect.\n\nOf course, variables that are UTF-8 and are referred to in the string retain that:\n\nmy $a = \"\\x{100}\";\nevalbytes 'print ord $a, \"\\n\"';\n\nprints\n\n256\n\nand $@ is empty.\n\nSource filters activated within the evaluated code apply to the code itself.\n\n\"evalbytes\" is available starting in Perl v5.16.  To access it, you must say\n\"CORE::evalbytes\", but you can omit the \"CORE::\" if the \"evalbytes\" feature is enabled.\nThis is enabled automatically with a \"use v5.16\" (or higher) declaration in the current\nscope.\n\nexec LIST\nexec PROGRAM LIST\nThe \"exec\" function executes a system command and never returns; use \"system\" instead of\n\"exec\" if you want it to return.  It fails and returns false only if the command does not\nexist and it is executed directly instead of via your system's command shell (see below).\n\nSince it's a common mistake to use \"exec\" instead of \"system\", Perl warns you if \"exec\"\nis called in void context and if there is a following statement that isn't \"die\", \"warn\",\nor \"exit\" (if warnings are enabled--but you always do that, right?).  If you really want\nto follow an \"exec\" with some other statement, you can use one of these styles to avoid\nthe warning:\n\nexec ('foo')   or print STDERR \"couldn't exec foo: $!\";\n{ exec ('foo') }; print STDERR \"couldn't exec foo: $!\";\n\nIf there is more than one argument in LIST, this calls execvp(3) with the arguments in\nLIST.  If there is only one element in LIST, the argument is checked for shell\nmetacharacters, and if there are any, the entire argument is passed to the system's\ncommand shell for parsing (this is \"/bin/sh -c\" on Unix platforms, but varies on other\nplatforms).  If there are no shell metacharacters in the argument, it is split into words\nand passed directly to \"execvp\", which is more efficient.  Examples:\n\nexec '/bin/echo', 'Your arguments are: ', @ARGV;\nexec \"sort $outfile | uniq\";\n\nIf you don't really want to execute the first argument, but want to lie to the program\nyou are executing about its own name, you can specify the program you actually want to\nrun as an \"indirect object\" (without a comma) in front of the LIST, as in \"exec PROGRAM\nLIST\".  (This always forces interpretation of the LIST as a multivalued list, even if\nthere is only a single scalar in the list.)  Example:\n\nmy $shell = '/bin/csh';\nexec $shell '-sh';    # pretend it's a login shell\n\nor, more directly,\n\nexec {'/bin/csh'} '-sh';  # pretend it's a login shell\n\nWhen the arguments get executed via the system shell, results are subject to its quirks\nand capabilities.  See \"`STRING`\" in perlop for details.\n\nUsing an indirect object with \"exec\" or \"system\" is also more secure.  This usage (which\nalso works fine with \"system\") forces interpretation of the arguments as a multivalued\nlist, even if the list had just one argument.  That way you're safe from the shell\nexpanding wildcards or splitting up words with whitespace in them.\n\nmy @args = ( \"echo surprise\" );\n\nexec @args;               # subject to shell escapes\n# if @args == 1\nexec { $args[0] } @args;  # safe even with one-arg list\n\nThe first version, the one without the indirect object, ran the echo program, passing it\n\"surprise\" an argument.  The second version didn't; it tried to run a program named \"echo\nsurprise\", didn't find it, and set $? to a non-zero value indicating failure.\n\nOn Windows, only the \"exec PROGRAM LIST\" indirect object syntax will reliably avoid using\nthe shell; \"exec LIST\", even with more than one element, will fall back to the shell if\nthe first spawn fails.\n\nPerl attempts to flush all files opened for output before the exec, but this may not be\nsupported on some platforms (see perlport).  To be safe, you may need to set $|\n($AUTOFLUSH in English) or call the \"autoflush\" method of \"IO::Handle\" on any open\nhandles to avoid lost output.\n\nNote that \"exec\" will not call your \"END\" blocks, nor will it invoke \"DESTROY\" methods on\nyour objects.\n\nPortability issues: \"exec\" in perlport.\n\nexists EXPR\nGiven an expression that specifies an element of a hash, returns true if the specified\nelement in the hash has ever been initialized, even if the corresponding value is\nundefined.\n\nprint \"Exists\\n\"    if exists $hash{$key};\nprint \"Defined\\n\"   if defined $hash{$key};\nprint \"True\\n\"      if $hash{$key};\n\nexists may also be called on array elements, but its behavior is much less obvious and is\nstrongly tied to the use of \"delete\" on arrays.\n\nWARNING: Calling \"exists\" on array values is strongly discouraged.  The notion of\ndeleting or checking the existence of Perl array elements is not conceptually coherent,\nand can lead to surprising behavior.\n\nprint \"Exists\\n\"    if exists $array[$index];\nprint \"Defined\\n\"   if defined $array[$index];\nprint \"True\\n\"      if $array[$index];\n\nA hash or array element can be true only if it's defined and defined only if it exists,\nbut the reverse doesn't necessarily hold true.\n\nGiven an expression that specifies the name of a subroutine, returns true if the\nspecified subroutine has ever been declared, even if it is undefined.  Mentioning a\nsubroutine name for exists or defined does not count as declaring it.  Note that a\nsubroutine that does not exist may still be callable: its package may have an \"AUTOLOAD\"\nmethod that makes it spring into existence the first time that it is called; see perlsub.\n\nprint \"Exists\\n\"  if exists &subroutine;\nprint \"Defined\\n\" if defined &subroutine;\n\nNote that the EXPR can be arbitrarily complicated as long as the final operation is a\nhash or array key lookup or subroutine name:\n\nif (exists $ref->{A}->{B}->{$key})  { }\nif (exists $hash{A}{B}{$key})       { }\n\nif (exists $ref->{A}->{B}->[$ix])   { }\nif (exists $hash{A}{B}[$ix])        { }\n\nif (exists &{$ref->{A}{B}{$key}})   { }\n\nAlthough the most deeply nested array or hash element will not spring into existence just\nbecause its existence was tested, any intervening ones will.  Thus \"$ref->{\"A\"}\" and\n\"$ref->{\"A\"}->{\"B\"}\" will spring into existence due to the existence test for the $key\nelement above.  This happens anywhere the arrow operator is used, including even here:\n\nundef $ref;\nif (exists $ref->{\"Some key\"})    { }\nprint $ref;  # prints HASH(0x80d3d5c)\n\nUse of a subroutine call, rather than a subroutine name, as an argument to \"exists\" is an\nerror.\n\nexists &sub;    # OK\nexists &sub();  # Error\n\nexit EXPR\nexit\nEvaluates EXPR and exits immediately with that value.    Example:\n\nmy $ans = <STDIN>;\nexit 0 if $ans =~ /^[Xx]/;\n\nSee also \"die\".  If EXPR is omitted, exits with 0 status.  The only universally\nrecognized values for EXPR are 0 for success and 1 for error; other values are subject to\ninterpretation depending on the environment in which the Perl program is running.  For\nexample, exiting 69 (EXUNAVAILABLE) from a sendmail incoming-mail filter will cause the\nmailer to return the item undelivered, but that's not true everywhere.\n\nDon't use \"exit\" to abort a subroutine if there's any chance that someone might want to\ntrap whatever error happened.  Use \"die\" instead, which can be trapped by an \"eval\".\n\nThe \"exit\" function does not always exit immediately.  It calls any defined \"END\"\nroutines first, but these \"END\" routines may not themselves abort the exit.  Likewise any\nobject destructors that need to be called are called before the real exit.  \"END\"\nroutines and destructors can change the exit status by modifying $?.  If this is a\nproblem, you can call \"POSIX::exit($status)\" to avoid \"END\" and destructor processing.\nSee perlmod for details.\n\nPortability issues: \"exit\" in perlport.\n\nexp EXPR\nexp Returns e (the natural logarithm base) to the power of EXPR.  If EXPR is omitted, gives\n\"exp($)\".\n\nfc EXPR\nfc  Returns the casefolded version of EXPR.  This is the internal function implementing the\n\"\\F\" escape in double-quoted strings.\n\nCasefolding is the process of mapping strings to a form where case differences are\nerased; comparing two strings in their casefolded form is effectively a way of asking if\ntwo strings are equal, regardless of case.\n\nRoughly, if you ever found yourself writing this\n\nlc($this) eq lc($that)    # Wrong!\n# or\nuc($this) eq uc($that)    # Also wrong!\n# or\n$this =~ /^\\Q$that\\E\\z/i  # Right!\n\nNow you can write\n\nfc($this) eq fc($that)\n\nAnd get the correct results.\n\nPerl only implements the full form of casefolding, but you can access the simple folds\nusing \"casefold()\" in Unicode::UCD and \"propinvmap()\" in Unicode::UCD.  For further\ninformation on casefolding, refer to the Unicode Standard, specifically sections 3.13\n\"Default Case Operations\", 4.2 \"Case-Normative\", and 5.18 \"Case Mappings\", available at\n<https://www.unicode.org/versions/latest/>, as well as the Case Charts available at\n<https://www.unicode.org/charts/case/>.\n\nIf EXPR is omitted, uses $.\n\nThis function behaves the same way under various pragmas, such as within\n\"use feature 'unicodestrings\", as \"lc\" does, with the single exception of \"fc\" of LATIN\nCAPITAL LETTER SHARP S (U+1E9E) within the scope of \"use locale\".  The foldcase of this\ncharacter would normally be \"ss\", but as explained in the \"lc\" section, case changes that\ncross the 255/256 boundary are problematic under locales, and are hence prohibited.\nTherefore, this function under locale returns instead the string \"\\x{17F}\\x{17F}\", which\nis the LATIN SMALL LETTER LONG S.  Since that character itself folds to \"s\", the string\nof two of them together should be equivalent to a single U+1E9E when foldcased.\n\nWhile the Unicode Standard defines two additional forms of casefolding, one for Turkic\nlanguages and one that never maps one character into multiple characters, these are not\nprovided by the Perl core.  However, the CPAN module \"Unicode::Casing\" may be used to\nprovide an implementation.\n\n\"fc\" is available only if the \"fc\" feature is enabled or if it is prefixed with \"CORE::\".\nThe \"fc\" feature is enabled automatically with a \"use v5.16\" (or higher) declaration in\nthe current scope.\n\nfcntl FILEHANDLE,FUNCTION,SCALAR\nImplements the fcntl(2) function.  You'll probably have to say\n\nuse Fcntl;\n\nfirst to get the correct constant definitions.  Argument processing and value returned\nwork just like \"ioctl\" below.  For example:\n\nuse Fcntl;\nmy $flags = fcntl($filehandle, FGETFL, 0)\nor die \"Can't fcntl FGETFL: $!\";\n\nYou don't have to check for \"defined\" on the return from \"fcntl\".  Like \"ioctl\", it maps\na 0 return from the system call into \"0 but true\" in Perl.  This string is true in\nboolean context and 0 in numeric context.  It is also exempt from the normal \"Argument\n\"...\" isn't numeric\" warnings on improper numeric conversions.\n\nNote that \"fcntl\" raises an exception if used on a machine that doesn't implement\nfcntl(2).  See the Fcntl module or your fcntl(2) manpage to learn what functions are\navailable on your system.\n\nHere's an example of setting a filehandle named $REMOTE to be non-blocking at the system\nlevel.  You'll have to negotiate $| on your own, though.\n\nuse Fcntl qw(FGETFL FSETFL ONONBLOCK);\n\nmy $flags = fcntl($REMOTE, FGETFL, 0)\nor die \"Can't get flags for the socket: $!\\n\";\n\nfcntl($REMOTE, FSETFL, $flags | ONONBLOCK)\nor die \"Can't set flags for the socket: $!\\n\";\n\nPortability issues: \"fcntl\" in perlport.\n\nFILE\nA special token that returns the name of the file in which it occurs.  It can be altered\nby the mechanism described at \"Plain Old Comments (Not!)\" in perlsyn.\n\nfileno FILEHANDLE\nfileno DIRHANDLE\nReturns the file descriptor for a filehandle or directory handle, or undefined if the\nfilehandle is not open.  If there is no real file descriptor at the OS level, as can\nhappen with filehandles connected to memory objects via \"open\" with a reference for the\nthird argument, -1 is returned.\n\nThis is mainly useful for constructing bitmaps for \"select\" and low-level POSIX tty-\nhandling operations.  If FILEHANDLE is an expression, the value is taken as an indirect\nfilehandle, generally its name.\n\nYou can use this to find out whether two handles refer to the same underlying descriptor:\n\nif (fileno($this) != -1 && fileno($this) == fileno($that)) {\nprint \"\\$this and \\$that are dups\\n\";\n} elsif (fileno($this) != -1 && fileno($that) != -1) {\nprint \"\\$this and \\$that have different \" .\n\"underlying file descriptors\\n\";\n} else {\nprint \"At least one of \\$this and \\$that does \" .\n\"not have a real file descriptor\\n\";\n}\n\nThe behavior of \"fileno\" on a directory handle depends on the operating system.  On a\nsystem with dirfd(3) or similar, \"fileno\" on a directory handle returns the underlying\nfile descriptor associated with the handle; on systems with no such support, it returns\nthe undefined value, and sets $! (errno).\n\nflock FILEHANDLE,OPERATION\nCalls flock(2), or an emulation of it, on FILEHANDLE.  Returns true for success, false on\nfailure.  Produces a fatal error if used on a machine that doesn't implement flock(2),\nfcntl(2) locking, or lockf(3).  \"flock\" is Perl's portable file-locking interface,\nalthough it locks entire files only, not records.\n\nTwo potentially non-obvious but traditional \"flock\" semantics are that it waits\nindefinitely until the lock is granted, and that its locks are merely advisory.  Such\ndiscretionary locks are more flexible, but offer fewer guarantees.  This means that\nprograms that do not also use \"flock\" may modify files locked with \"flock\".  See\nperlport, your port's specific documentation, and your system-specific local manpages for\ndetails.  It's best to assume traditional behavior if you're writing portable programs.\n(But if you're not, you should as always feel perfectly free to write for your own\nsystem's idiosyncrasies (sometimes called \"features\").  Slavish adherence to portability\nconcerns shouldn't get in the way of your getting your job done.)\n\nOPERATION is one of LOCKSH, LOCKEX, or LOCKUN, possibly combined with LOCKNB.  These\nconstants are traditionally valued 1, 2, 8 and 4, but you can use the symbolic names if\nyou import them from the Fcntl module, either individually, or as a group using the\n\":flock\" tag.  LOCKSH requests a shared lock, LOCKEX requests an exclusive lock, and\nLOCKUN releases a previously requested lock.  If LOCKNB is bitwise-or'ed with LOCKSH\nor LOCKEX, then \"flock\" returns immediately rather than blocking waiting for the lock;\ncheck the return status to see if you got it.\n\nTo avoid the possibility of miscoordination, Perl now flushes FILEHANDLE before locking\nor unlocking it.\n\nNote that the emulation built with lockf(3) doesn't provide shared locks, and it requires\nthat FILEHANDLE be open with write intent.  These are the semantics that lockf(3)\nimplements.  Most if not all systems implement lockf(3) in terms of fcntl(2) locking,\nthough, so the differing semantics shouldn't bite too many people.\n\nNote that the fcntl(2) emulation of flock(3) requires that FILEHANDLE be open with read\nintent to use LOCKSH and requires that it be open with write intent to use LOCKEX.\n\nNote also that some versions of \"flock\" cannot lock things over the network; you would\nneed to use the more system-specific \"fcntl\" for that.  If you like you can force Perl to\nignore your system's flock(2) function, and so provide its own fcntl(2)-based emulation,\nby passing the switch \"-Udflock\" to the Configure program when you configure and build a\nnew Perl.\n\nHere's a mailbox appender for BSD systems.\n\n# import LOCK* and SEEKEND constants\nuse Fcntl qw(:flock SEEKEND);\n\nsub lock {\nmy ($fh) = @;\nflock($fh, LOCKEX) or die \"Cannot lock mailbox - $!\\n\";\n# and, in case we're running on a very old UNIX\n# variant without the modern OAPPEND semantics...\nseek($fh, 0, SEEKEND) or die \"Cannot seek - $!\\n\";\n}\n\nsub unlock {\nmy ($fh) = @;\nflock($fh, LOCKUN) or die \"Cannot unlock mailbox - $!\\n\";\n}\n\nopen(my $mbox, \">>\", \"/usr/spool/mail/$ENV{'USER'}\")\nor die \"Can't open mailbox: $!\";\n\nlock($mbox);\nprint $mbox $msg,\"\\n\\n\";\nunlock($mbox);\n\nOn systems that support a real flock(2), locks are inherited across \"fork\" calls, whereas\nthose that must resort to the more capricious fcntl(2) function lose their locks, making\nit seriously harder to write servers.\n\nSee also DBFile for other \"flock\" examples.\n\nPortability issues: \"flock\" in perlport.\n\nfork\nDoes a fork(2) system call to create a new process running the same program at the same\npoint.  It returns the child pid to the parent process, 0 to the child process, or\n\"undef\" if the fork is unsuccessful.  File descriptors (and sometimes locks on those\ndescriptors) are shared, while everything else is copied.  On most systems supporting\nfork(2), great care has gone into making it extremely efficient (for example, using copy-\non-write technology on data pages), making it the dominant paradigm for multitasking over\nthe last few decades.\n\nPerl attempts to flush all files opened for output before forking the child process, but\nthis may not be supported on some platforms (see perlport).  To be safe, you may need to\nset $| ($AUTOFLUSH in English) or call the \"autoflush\" method of \"IO::Handle\" on any open\nhandles to avoid duplicate output.\n\nIf you \"fork\" without ever waiting on your children, you will accumulate zombies.  On\nsome systems, you can avoid this by setting $SIG{CHLD} to \"IGNORE\".  See also perlipc for\nmore examples of forking and reaping moribund children.\n\nNote that if your forked child inherits system file descriptors like STDIN and STDOUT\nthat are actually connected by a pipe or socket, even if you exit, then the remote server\n(such as, say, a CGI script or a backgrounded job launched from a remote shell) won't\nthink you're done.  You should reopen those to /dev/null if it's any issue.\n\nOn some platforms such as Windows, where the fork(2) system call is not available, Perl\ncan be built to emulate \"fork\" in the Perl interpreter.  The emulation is designed, at\nthe level of the Perl program, to be as compatible as possible with the \"Unix\" fork(2).\nHowever it has limitations that have to be considered in code intended to be portable.\nSee perlfork for more details.\n\nPortability issues: \"fork\" in perlport.\n\nformat\nDeclare a picture format for use by the \"write\" function.  For example:\n\nformat Something =\nTest: @<<<<<<<< @||||| @>>>>>\n$str,     $%,    '$' . int($num)\n.\n\n$str = \"widget\";\n$num = $cost/$quantity;\n$~ = 'Something';\nwrite;\n\nSee perlform for many details and examples.\n\nformline PICTURE,LIST\nThis is an internal function used by \"format\"s, though you may call it, too.  It formats\n(see perlform) a list of values according to the contents of PICTURE, placing the output\ninto the format output accumulator, $^A (or $ACCUMULATOR in English).  Eventually, when a\n\"write\" is done, the contents of $^A are written to some filehandle.  You could also read\n$^A and then set $^A back to \"\".  Note that a format typically does one \"formline\" per\nline of form, but the \"formline\" function itself doesn't care how many newlines are\nembedded in the PICTURE.  This means that the \"~\" and \"~~\" tokens treat the entire\nPICTURE as a single line.  You may therefore need to use multiple formlines to implement\na single record format, just like the \"format\" compiler.\n\nBe careful if you put double quotes around the picture, because an \"@\" character may be\ntaken to mean the beginning of an array name.  \"formline\" always returns true.  See\nperlform for other examples.\n\nIf you are trying to use this instead of \"write\" to capture the output, you may find it\neasier to open a filehandle to a scalar (\"open my $fh, \">\", \\$output\") and write to that\ninstead.\n\ngetc FILEHANDLE\ngetc\nReturns the next character from the input file attached to FILEHANDLE, or the undefined\nvalue at end of file or if there was an error (in the latter case $! is set).  If\nFILEHANDLE is omitted, reads from STDIN.  This is not particularly efficient.  However,\nit cannot be used by itself to fetch single characters without waiting for the user to\nhit enter.  For that, try something more like:\n\nif ($BSDSTYLE) {\nsystem \"stty cbreak </dev/tty >/dev/tty 2>&1\";\n}\nelse {\nsystem \"stty\", '-icanon', 'eol', \"\\001\";\n}\n\nmy $key = getc(STDIN);\n\nif ($BSDSTYLE) {\nsystem \"stty -cbreak </dev/tty >/dev/tty 2>&1\";\n}\nelse {\nsystem 'stty', 'icanon', 'eol', '^@'; # ASCII NUL\n}\nprint \"\\n\";\n\nDetermination of whether $BSDSTYLE should be set is left as an exercise to the reader.\n\nThe \"POSIX::getattr\" function can do this more portably on systems purporting POSIX\ncompliance.  See also the \"Term::ReadKey\" module on CPAN.\n\ngetlogin\nThis implements the C library function of the same name, which on most systems returns\nthe current login from /etc/utmp, if any.  If it returns the empty string, use\n\"getpwuid\".\n\nmy $login = getlogin || getpwuid($<) || \"Kilroy\";\n\nDo not consider \"getlogin\" for authentication: it is not as secure as \"getpwuid\".\n\nPortability issues: \"getlogin\" in perlport.\n\ngetpeername SOCKET\nReturns the packed sockaddr address of the other end of the SOCKET connection.\n\nuse Socket;\nmy $hersockaddr    = getpeername($sock);\nmy ($port, $iaddr) = sockaddrin($hersockaddr);\nmy $herhostname    = gethostbyaddr($iaddr, AFINET);\nmy $herstraddr     = inetntoa($iaddr);\n\ngetpgrp PID\nReturns the current process group for the specified PID.  Use a PID of 0 to get the\ncurrent process group for the current process.  Will raise an exception if used on a\nmachine that doesn't implement getpgrp(2).  If PID is omitted, returns the process group\nof the current process.  Note that the POSIX version of \"getpgrp\" does not accept a PID\nargument, so only \"PID==0\" is truly portable.\n\nPortability issues: \"getpgrp\" in perlport.\n\ngetppid\nReturns the process id of the parent process.\n\nNote for Linux users: Between v5.8.1 and v5.16.0 Perl would work around non-POSIX thread\nsemantics the minority of Linux systems (and Debian GNU/kFreeBSD systems) that used\nLinuxThreads, this emulation has since been removed.  See the documentation for $$ for\ndetails.\n\nPortability issues: \"getppid\" in perlport.\n\ngetpriority WHICH,WHO\nReturns the current priority for a process, a process group, or a user.  (See\ngetpriority(2).)  Will raise a fatal exception if used on a machine that doesn't\nimplement getpriority(2).\n\n\"WHICH\" can be any of \"PRIOPROCESS\", \"PRIOPGRP\" or \"PRIOUSER\" imported from \"RESOURCE\nCONSTANTS\" in POSIX.\n\nPortability issues: \"getpriority\" in perlport.\n\ngetpwnam NAME\ngetgrnam NAME\ngethostbyname NAME\ngetnetbyname NAME\ngetprotobyname NAME\ngetpwuid UID\ngetgrgid GID\ngetservbyname NAME,PROTO\ngethostbyaddr ADDR,ADDRTYPE\ngetnetbyaddr ADDR,ADDRTYPE\ngetprotobynumber NUMBER\ngetservbyport PORT,PROTO\ngetpwent\ngetgrent\ngethostent\ngetnetent\ngetprotoent\ngetservent\nsetpwent\nsetgrent\nsethostent STAYOPEN\nsetnetent STAYOPEN\nsetprotoent STAYOPEN\nsetservent STAYOPEN\nendpwent\nendgrent\nendhostent\nendnetent\nendprotoent\nendservent\nThese routines are the same as their counterparts in the system C library.  In list\ncontext, the return values from the various get routines are as follows:\n\n#    0        1          2           3         4\nmy ( $name,   $passwd,   $gid,       $members  ) = getgr*\nmy ( $name,   $aliases,  $addrtype,  $net      ) = getnet*\nmy ( $name,   $aliases,  $port,      $proto    ) = getserv*\nmy ( $name,   $aliases,  $proto                ) = getproto*\nmy ( $name,   $aliases,  $addrtype,  $length,  @addrs ) = gethost*\nmy ( $name,   $passwd,   $uid,       $gid,     $quota,\n$comment,  $gcos,     $dir,       $shell,   $expire ) = getpw*\n#    5        6          7           8         9\n\n(If the entry doesn't exist, the return value is a single meaningless true value.)\n\nThe exact meaning of the $gcos field varies but it usually contains the real name of the\nuser (as opposed to the login name) and other information pertaining to the user.\nBeware, however, that in many system users are able to change this information and\ntherefore it cannot be trusted and therefore the $gcos is tainted (see perlsec).  The\n$passwd and $shell, user's encrypted password and login shell, are also tainted, for the\nsame reason.\n\nIn scalar context, you get the name, unless the function was a lookup by name, in which\ncase you get the other thing, whatever it is.  (If the entry doesn't exist you get the\nundefined value.)  For example:\n\nmy $uid   = getpwnam($name);\nmy $name  = getpwuid($num);\nmy $name  = getpwent();\nmy $gid   = getgrnam($name);\nmy $name  = getgrgid($num);\nmy $name  = getgrent();\n# etc.\n\nIn getpw*() the fields $quota, $comment, and $expire are special in that they are\nunsupported on many systems.  If the $quota is unsupported, it is an empty scalar.  If it\nis supported, it usually encodes the disk quota.  If the $comment field is unsupported,\nit is an empty scalar.  If it is supported it usually encodes some administrative comment\nabout the user.  In some systems the $quota field may be $change or $age, fields that\nhave to do with password aging.  In some systems the $comment field may be $class.  The\n$expire field, if present, encodes the expiration period of the account or the password.\nFor the availability and the exact meaning of these fields in your system, please consult\ngetpwnam(3) and your system's pwd.h file.  You can also find out from within Perl what\nyour $quota and $comment fields mean and whether you have the $expire field by using the\n\"Config\" module and the values \"dpwquota\", \"dpwage\", \"dpwchange\", \"dpwcomment\", and\n\"dpwexpire\".  Shadow password files are supported only if your vendor has implemented\nthem in the intuitive fashion that calling the regular C library routines gets the shadow\nversions if you're running under privilege or if there exists the shadow(3) functions as\nfound in System V (this includes Solaris and Linux).  Those systems that implement a\nproprietary shadow password facility are unlikely to be supported.\n\nThe $members value returned by getgr*() is a space-separated list of the login names of\nthe members of the group.\n\nFor the gethost*() functions, if the \"herrno\" variable is supported in C, it will be\nreturned to you via $? if the function call fails.  The @addrs value returned by a\nsuccessful call is a list of raw addresses returned by the corresponding library call.\nIn the Internet domain, each address is four bytes long; you can unpack it by saying\nsomething like:\n\nmy ($w,$x,$y,$z) = unpack('W4',$addr[0]);\n\nThe Socket library makes this slightly easier:\n\nuse Socket;\nmy $iaddr = inetaton(\"127.1\"); # or whatever address\nmy $name  = gethostbyaddr($iaddr, AFINET);\n\n# or going the other way\nmy $straddr = inetntoa($iaddr);\n\nIn the opposite way, to resolve a hostname to the IP address you can write this:\n\nuse Socket;\nmy $packedip = gethostbyname(\"www.perl.org\");\nmy $ipaddress;\nif (defined $packedip) {\n$ipaddress = inetntoa($packedip);\n}\n\nMake sure \"gethostbyname\" is called in SCALAR context and that its return value is\nchecked for definedness.\n\nThe \"getprotobynumber\" function, even though it only takes one argument, has the\nprecedence of a list operator, so beware:\n\ngetprotobynumber $number eq 'icmp'   # WRONG\ngetprotobynumber($number eq 'icmp')  # actually means this\ngetprotobynumber($number) eq 'icmp'  # better this way\n\nIf you get tired of remembering which element of the return list contains which return\nvalue, by-name interfaces are provided in standard modules: \"File::stat\", \"Net::hostent\",\n\"Net::netent\", \"Net::protoent\", \"Net::servent\", \"Time::gmtime\", \"Time::localtime\", and\n\"User::grent\".  These override the normal built-ins, supplying versions that return\nobjects with the appropriate names for each field.  For example:\n\nuse File::stat;\nuse User::pwent;\nmy $ishis = (stat($filename)->uid == pwent($whoever)->uid);\n\nEven though it looks as though they're the same method calls (uid), they aren't, because\na \"File::stat\" object is different from a \"User::pwent\" object.\n\nMany of these functions are not safe in a multi-threaded environment where more than one\nthread can be using them.  In particular, functions like \"getpwent()\" iterate per-process\nand not per-thread, so if two threads are simultaneously iterating, neither will get all\nthe records.\n\nSome systems have thread-safe versions of some of the functions, such as \"getpwnamr()\"\ninstead of \"getpwnam()\".  There, Perl automatically and invisibly substitutes the thread-\nsafe version, without notice.  This means that code that safely runs on some systems can\nfail on others that lack the thread-safe versions.\n\nPortability issues: \"getpwnam\" in perlport to \"endservent\" in perlport.\n\ngetsockname SOCKET\nReturns the packed sockaddr address of this end of the SOCKET connection, in case you\ndon't know the address because you have several different IPs that the connection might\nhave come in on.\n\nuse Socket;\nmy $mysockaddr = getsockname($sock);\nmy ($port, $myaddr) = sockaddrin($mysockaddr);\nprintf \"Connect to %s [%s]\\n\",\nscalar gethostbyaddr($myaddr, AFINET),\ninetntoa($myaddr);\n\ngetsockopt SOCKET,LEVEL,OPTNAME\nQueries the option named OPTNAME associated with SOCKET at a given LEVEL.  Options may\nexist at multiple protocol levels depending on the socket type, but at least the\nuppermost socket level SOLSOCKET (defined in the \"Socket\" module) will exist.  To query\noptions at another level the protocol number of the appropriate protocol controlling the\noption should be supplied.  For example, to indicate that an option is to be interpreted\nby the TCP protocol, LEVEL should be set to the protocol number of TCP, which you can get\nusing \"getprotobyname\".\n\nThe function returns a packed string representing the requested socket option, or \"undef\"\non error, with the reason for the error placed in $!.  Just what is in the packed string\ndepends on LEVEL and OPTNAME; consult getsockopt(2) for details.  A common case is that\nthe option is an integer, in which case the result is a packed integer, which you can\ndecode using \"unpack\" with the \"i\" (or \"I\") format.\n\nHere's an example to test whether Nagle's algorithm is enabled on a socket:\n\nuse Socket qw(:all);\n\ndefined(my $tcp = getprotobyname(\"tcp\"))\nor die \"Could not determine the protocol number for tcp\";\n# my $tcp = IPPROTOTCP; # Alternative\nmy $packed = getsockopt($socket, $tcp, TCPNODELAY)\nor die \"getsockopt TCPNODELAY: $!\";\nmy $nodelay = unpack(\"I\", $packed);\nprint \"Nagle's algorithm is turned \",\n$nodelay ? \"off\\n\" : \"on\\n\";\n\nPortability issues: \"getsockopt\" in perlport.\n\nglob EXPR\nglob\nIn list context, returns a (possibly empty) list of filename expansions on the value of\nEXPR such as the standard Unix shell /bin/csh would do.  In scalar context, glob iterates\nthrough such filename expansions, returning undef when the list is exhausted.  This is\nthe internal function implementing the \"<*.c>\" operator, but you can use it directly.  If\nEXPR is omitted, $ is used.  The \"<*.c>\" operator is discussed in more detail in \"I/O\nOperators\" in perlop.\n\nNote that \"glob\" splits its arguments on whitespace and treats each segment as separate\npattern.  As such, \"glob(\"*.c *.h\")\" matches all files with a .c or .h extension.  The\nexpression \"glob(\".* *\")\" matches all files in the current working directory.  If you\nwant to glob filenames that might contain whitespace, you'll have to use extra quotes\naround the spacey filename to protect it.  For example, to glob filenames that have an\n\"e\" followed by a space followed by an \"f\", use one of:\n\nmy @spacies = <\"*e f*\">;\nmy @spacies = glob '\"*e f*\"';\nmy @spacies = glob q(\"*e f*\");\n\nIf you had to get a variable through, you could do this:\n\nmy @spacies = glob \"'*${var}e f*'\";\nmy @spacies = glob qq(\"*${var}e f*\");\n\nIf non-empty braces are the only wildcard characters used in the \"glob\", no filenames are\nmatched, but potentially many strings are returned.  For example, this produces nine\nstrings, one for each pairing of fruits and colors:\n\nmy @many = glob \"{apple,tomato,cherry}={green,yellow,red}\";\n\nThis operator is implemented using the standard \"File::Glob\" extension.  See File::Glob\nfor details, including \"bsdglob\", which does not treat whitespace as a pattern\nseparator.\n\nIf a \"glob\" expression is used as the condition of a \"while\" or \"for\" loop, then it will\nbe implicitly assigned to $.  If either a \"glob\" expression or an explicit assignment of\na \"glob\" expression to a scalar is used as a \"while\"/\"for\" condition, then the condition\nactually tests for definedness of the expression's value, not for its regular truth\nvalue.\n\nPortability issues: \"glob\" in perlport.\n\ngmtime EXPR\ngmtime\nWorks just like \"localtime\", but the returned values are localized for the standard\nGreenwich time zone.\n\nNote: When called in list context, $isdst, the last value returned by gmtime, is always\n0.  There is no Daylight Saving Time in GMT.\n\nPortability issues: \"gmtime\" in perlport.\n\ngoto LABEL\ngoto EXPR\ngoto &NAME\nThe \"goto LABEL\" form finds the statement labeled with LABEL and resumes execution there.\nIt can't be used to get out of a block or subroutine given to \"sort\".  It can be used to\ngo almost anywhere else within the dynamic scope, including out of subroutines, but it's\nusually better to use some other construct such as \"last\" or \"die\".  The author of Perl\nhas never felt the need to use this form of \"goto\" (in Perl, that is; C is another\nmatter).  (The difference is that C does not offer named loops combined with loop\ncontrol.  Perl does, and this replaces most structured uses of \"goto\" in other\nlanguages.)\n\nThe \"goto EXPR\" form expects to evaluate \"EXPR\" to a code reference or a label name.  If\nit evaluates to a code reference, it will be handled like \"goto &NAME\", below.  This is\nespecially useful for implementing tail recursion via \"goto SUB\".\n\nIf the expression evaluates to a label name, its scope will be resolved dynamically.\nThis allows for computed \"goto\"s per FORTRAN, but isn't necessarily recommended if you're\noptimizing for maintainability:\n\ngoto (\"FOO\", \"BAR\", \"GLARCH\")[$i];\n\nAs shown in this example, \"goto EXPR\" is exempt from the \"looks like a function\" rule.  A\npair of parentheses following it does not (necessarily) delimit its argument.\n\"goto(\"NE\").\"XT\"\" is equivalent to \"goto NEXT\".  Also, unlike most named operators, this\nhas the same precedence as assignment.\n\nUse of \"goto LABEL\" or \"goto EXPR\" to jump into a construct is deprecated and will issue\na warning.  Even then, it may not be used to go into any construct that requires\ninitialization, such as a subroutine, a \"foreach\" loop, or a \"given\" block.  In general,\nit may not be used to jump into the parameter of a binary or list operator, but it may be\nused to jump into the first parameter of a binary operator.  (The \"=\" assignment\noperator's \"first\" operand is its right-hand operand.)  It also can't be used to go into\na construct that is optimized away.\n\nThe \"goto &NAME\" form is quite different from the other forms of \"goto\".  In fact, it\nisn't a goto in the normal sense at all, and doesn't have the stigma associated with\nother gotos.  Instead, it exits the current subroutine (losing any changes set by\n\"local\") and immediately calls in its place the named subroutine using the current value\nof @.  This is used by \"AUTOLOAD\" subroutines that wish to load another subroutine and\nthen pretend that the other subroutine had been called in the first place (except that\nany modifications to @ in the current subroutine are propagated to the other\nsubroutine.) After the \"goto\", not even \"caller\" will be able to tell that this routine\nwas called first.\n\nNAME needn't be the name of a subroutine; it can be a scalar variable containing a code\nreference or a block that evaluates to a code reference.\n\ngrep BLOCK LIST\ngrep EXPR,LIST\nThis is similar in spirit to, but not the same as, grep(1) and its relatives.  In\nparticular, it is not limited to using regular expressions.\n\nEvaluates the BLOCK or EXPR for each element of LIST (locally setting $ to each element)\nand returns the list value consisting of those elements for which the expression\nevaluated to true.  In scalar context, returns the number of times the expression was\ntrue.\n\nmy @foo = grep(!/^#/, @bar);    # weed out comments\n\nor equivalently,\n\nmy @foo = grep {!/^#/} @bar;    # weed out comments\n\nNote that $ is an alias to the list value, so it can be used to modify the elements of\nthe LIST.  While this is useful and supported, it can cause bizarre results if the\nelements of LIST are not variables.  Similarly, grep returns aliases into the original\nlist, much as a for loop's index variable aliases the list elements.  That is, modifying\nan element of a list returned by grep (for example, in a \"foreach\", \"map\" or another\n\"grep\") actually modifies the element in the original list.  This is usually something to\nbe avoided when writing clear code.\n\nSee also \"map\" for a list composed of the results of the BLOCK or EXPR.\n\nhex EXPR\nhex Interprets EXPR as a hex string and returns the corresponding numeric value.  If EXPR is\nomitted, uses $.\n\nprint hex '0xAf'; # prints '175'\nprint hex 'aF';   # same\n$validinput =~ /\\A(?:0?[xX])?(?:?[0-9a-fA-F])*\\z/\n\nA hex string consists of hex digits and an optional \"0x\" or \"x\" prefix.  Each hex digit\nmay be preceded by a single underscore, which will be ignored.  Any other character\ntriggers a warning and causes the rest of the string to be ignored (even leading\nwhitespace, unlike \"oct\").  Only integers can be represented, and integer overflow\ntriggers a warning.\n\nTo convert strings that might start with any of 0, \"0x\", or \"0b\", see \"oct\".  To present\nsomething as hex, look into \"printf\", \"sprintf\", and \"unpack\".\n\nimport LIST\nThere is no builtin \"import\" function.  It is just an ordinary method (subroutine)\ndefined (or inherited) by modules that wish to export names to another module.  The \"use\"\nfunction calls the \"import\" method for the package used.  See also \"use\", perlmod, and\nExporter.\n\nindex STR,SUBSTR,POSITION\nindex STR,SUBSTR\nThe index function searches for one string within another, but without the wildcard-like\nbehavior of a full regular-expression pattern match.  It returns the position of the\nfirst occurrence of SUBSTR in STR at or after POSITION.  If POSITION is omitted, starts\nsearching from the beginning of the string.  POSITION before the beginning of the string\nor after its end is treated as if it were the beginning or the end, respectively.\nPOSITION and the return value are based at zero.  If the substring is not found, \"index\"\nreturns -1.\n\nFind characters or strings:\n\nindex(\"Perl is great\", \"P\");     # Returns 0\nindex(\"Perl is great\", \"g\");     # Returns 8\nindex(\"Perl is great\", \"great\"); # Also returns 8\n\nAttempting to find something not there:\n\nindex(\"Perl is great\", \"Z\");     # Returns -1 (not found)\n\nUsing an offset to find the second occurrence:\n\nindex(\"Perl is great\", \"e\", 5);  # Returns 10\n\nint EXPR\nint Returns the integer portion of EXPR.  If EXPR is omitted, uses $.  You should not use\nthis function for rounding: one because it truncates towards 0, and two because machine\nrepresentations of floating-point numbers can sometimes produce counterintuitive results.\nFor example, \"int(-6.725/0.025)\" produces -268 rather than the correct -269; that's\nbecause it's really more like -268.99999999999994315658 instead.  Usually, the \"sprintf\",\n\"printf\", or the \"POSIX::floor\" and \"POSIX::ceil\" functions will serve you better than\nwill \"int\".\n\nioctl FILEHANDLE,FUNCTION,SCALAR\nImplements the ioctl(2) function.  You'll probably first have to say\n\nrequire \"sys/ioctl.ph\";  # probably in\n# $Config{archlib}/sys/ioctl.ph\n\nto get the correct function definitions.  If sys/ioctl.ph doesn't exist or doesn't have\nthe correct definitions you'll have to roll your own, based on your C header files such\nas <sys/ioctl.h>.  (There is a Perl script called h2ph that comes with the Perl kit that\nmay help you in this, but it's nontrivial.)  SCALAR will be read and/or written depending\non the FUNCTION; a C pointer to the string value of SCALAR will be passed as the third\nargument of the actual \"ioctl\" call.  (If SCALAR has no string value but does have a\nnumeric value, that value will be passed rather than a pointer to the string value.  To\nguarantee this to be true, add a 0 to the scalar before using it.)  The \"pack\" and\n\"unpack\" functions may be needed to manipulate the values of structures used by \"ioctl\".\n\nThe return value of \"ioctl\" (and \"fcntl\") is as follows:\n\nif OS returns:      then Perl returns:\n-1               undefined value\n0              string \"0 but true\"\nanything else           that number\n\nThus Perl returns true on success and false on failure, yet you can still easily\ndetermine the actual value returned by the operating system:\n\nmy $retval = ioctl(...) || -1;\nprintf \"System returned %d\\n\", $retval;\n\nThe special string \"0 but true\" is exempt from \"Argument \"...\" isn't numeric\" warnings on\nimproper numeric conversions.\n\nPortability issues: \"ioctl\" in perlport.\n\njoin EXPR,LIST\nJoins the separate strings of LIST into a single string with fields separated by the\nvalue of EXPR, and returns that new string.  Example:\n\nmy $rec = join(':', $login,$passwd,$uid,$gid,$gcos,$home,$shell);\n\nBeware that unlike \"split\", \"join\" doesn't take a pattern as its first argument.  Compare\n\"split\".\n\nkeys HASH\nkeys ARRAY\nCalled in list context, returns a list consisting of all the keys of the named hash, or\nin Perl 5.12 or later only, the indices of an array.  Perl releases prior to 5.12 will\nproduce a syntax error if you try to use an array argument.  In scalar context, returns\nthe number of keys or indices.\n\nHash entries are returned in an apparently random order.  The actual random order is\nspecific to a given hash; the exact same series of operations on two hashes may result in\na different order for each hash.  Any insertion into the hash may change the order, as\nwill any deletion, with the exception that the most recent key returned by \"each\" or\n\"keys\" may be deleted without changing the order.  So long as a given hash is unmodified\nyou may rely on \"keys\", \"values\" and \"each\" to repeatedly return the same order as each\nother.  See \"Algorithmic Complexity Attacks\" in perlsec for details on why hash order is\nrandomized.  Aside from the guarantees provided here the exact details of Perl's hash\nalgorithm and the hash traversal order are subject to change in any release of Perl.\nTied hashes may behave differently to Perl's hashes with respect to changes in order on\ninsertion and deletion of items.\n\nAs a side effect, calling \"keys\" resets the internal iterator of the HASH or ARRAY (see\n\"each\") before yielding the keys.  In particular, calling \"keys\" in void context resets\nthe iterator with no other overhead.\n\nHere is yet another way to print your environment:\n\nmy @keys = keys %ENV;\nmy @values = values %ENV;\nwhile (@keys) {\nprint pop(@keys), '=', pop(@values), \"\\n\";\n}\n\nor how about sorted by key:\n\nforeach my $key (sort(keys %ENV)) {\nprint $key, '=', $ENV{$key}, \"\\n\";\n}\n\nThe returned values are copies of the original keys in the hash, so modifying them will\nnot affect the original hash.  Compare \"values\".\n\nTo sort a hash by value, you'll need to use a \"sort\" function.  Here's a descending\nnumeric sort of a hash by its values:\n\nforeach my $key (sort { $hash{$b} <=> $hash{$a} } keys %hash) {\nprintf \"%4d %s\\n\", $hash{$key}, $key;\n}\n\nUsed as an lvalue, \"keys\" allows you to increase the number of hash buckets allocated for\nthe given hash.  This can gain you a measure of efficiency if you know the hash is going\nto get big.  (This is similar to pre-extending an array by assigning a larger number to\n$#array.)  If you say\n\nkeys %hash = 200;\n\nthen %hash will have at least 200 buckets allocated for it--256 of them, in fact, since\nit rounds up to the next power of two.  These buckets will be retained even if you do\n\"%hash = ()\", use \"undef %hash\" if you want to free the storage while %hash is still in\nscope.  You can't shrink the number of buckets allocated for the hash using \"keys\" in\nthis way (but you needn't worry about doing this by accident, as trying has no effect).\n\"keys @array\" in an lvalue context is a syntax error.\n\nStarting with Perl 5.14, an experimental feature allowed \"keys\" to take a scalar\nexpression. This experiment has been deemed unsuccessful, and was removed as of Perl\n5.24.\n\nTo avoid confusing would-be users of your code who are running earlier versions of Perl\nwith mysterious syntax errors, put this sort of thing at the top of your file to signal\nthat your code will work only on Perls of a recent vintage:\n\nuse 5.012;  # so keys/values/each work on arrays\n\nSee also \"each\", \"values\", and \"sort\".\n\nkill SIGNAL, LIST\nkill SIGNAL\nSends a signal to a list of processes.  Returns the number of arguments that were\nsuccessfully used to signal (which is not necessarily the same as the number of processes\nactually killed, e.g. where a process group is killed).\n\nmy $cnt = kill 'HUP', $child1, $child2;\nkill 'KILL', @goners;\n\nSIGNAL may be either a signal name (a string) or a signal number.  A signal name may\nstart with a \"SIG\" prefix, thus \"FOO\" and \"SIGFOO\" refer to the same signal.  The string\nform of SIGNAL is recommended for portability because the same signal may have different\nnumbers in different operating systems.\n\nA list of signal names supported by the current platform can be found in\n$Config{signame}, which is provided by the \"Config\" module.  See Config for more\ndetails.\n\nA negative signal name is the same as a negative signal number, killing process groups\ninstead of processes.  For example, \"kill '-KILL', $pgrp\" and \"kill -9, $pgrp\" will send\n\"SIGKILL\" to the entire process group specified.  That means you usually want to use\npositive not negative signals.\n\nIf SIGNAL is either the number 0 or the string \"ZERO\" (or \"SIGZERO\"), no signal is sent\nto the process, but \"kill\" checks whether it's possible to send a signal to it (that\nmeans, to be brief, that the process is owned by the same user, or we are the super-\nuser).  This is useful to check that a child process is still alive (even if only as a\nzombie) and hasn't changed its UID.  See perlport for notes on the portability of this\nconstruct.\n\nThe behavior of kill when a PROCESS number is zero or negative depends on the operating\nsystem.  For example, on POSIX-conforming systems, zero will signal the current process\ngroup, -1 will signal all processes, and any other negative PROCESS number will act as a\nnegative signal number and kill the entire process group specified.\n\nIf both the SIGNAL and the PROCESS are negative, the results are undefined.  A warning\nmay be produced in a future version.\n\nSee \"Signals\" in perlipc for more details.\n\nOn some platforms such as Windows where the fork(2) system call is not available, Perl\ncan be built to emulate \"fork\" at the interpreter level.  This emulation has limitations\nrelated to kill that have to be considered, for code running on Windows and in code\nintended to be portable.\n\nSee perlfork for more details.\n\nIf there is no LIST of processes, no signal is sent, and the return value is 0.  This\nform is sometimes used, however, because it causes tainting checks to be run.  But see\n\"Laundering and Detecting Tainted Data\" in perlsec.\n\nPortability issues: \"kill\" in perlport.\n\nlast LABEL\nlast EXPR\nlast\nThe \"last\" command is like the \"break\" statement in C (as used in loops); it immediately\nexits the loop in question.  If the LABEL is omitted, the command refers to the innermost\nenclosing loop.  The \"last EXPR\" form, available starting in Perl 5.18.0, allows a label\nname to be computed at run time, and is otherwise identical to \"last LABEL\".  The\n\"continue\" block, if any, is not executed:\n\nLINE: while (<STDIN>) {\nlast LINE if /^$/;  # exit when done with header\n#...\n}\n\n\"last\" cannot return a value from a block that typically returns a value, such as \"eval\n{}\", \"sub {}\", or \"do {}\". It will perform its flow control behavior, which precludes any\nreturn value. It should not be used to exit a \"grep\" or \"map\" operation.\n\nNote that a block by itself is semantically identical to a loop that executes once.  Thus\n\"last\" can be used to effect an early exit out of such a block.\n\nSee also \"continue\" for an illustration of how \"last\", \"next\", and \"redo\" work.\n\nUnlike most named operators, this has the same precedence as assignment.  It is also\nexempt from the looks-like-a-function rule, so \"last (\"foo\").\"bar\"\" will cause \"bar\" to\nbe part of the argument to \"last\".\n\nlc EXPR\nlc  Returns a lowercased version of EXPR.  This is the internal function implementing the\n\"\\L\" escape in double-quoted strings.\n\nIf EXPR is omitted, uses $.\n\nWhat gets returned depends on several factors:\n\nIf \"use bytes\" is in effect:\nThe results follow ASCII rules.  Only the characters \"A-Z\" change, to \"a-z\"\nrespectively.\n\nOtherwise, if \"use locale\" for \"LCCTYPE\" is in effect:\nRespects current \"LCCTYPE\" locale for code points < 256; and uses Unicode rules for\nthe remaining code points (this last can only happen if the UTF8 flag is also set).\nSee perllocale.\n\nStarting in v5.20, Perl uses full Unicode rules if the locale is UTF-8.  Otherwise,\nthere is a deficiency in this scheme, which is that case changes that cross the\n255/256 boundary are not well-defined.  For example, the lower case of LATIN CAPITAL\nLETTER SHARP S (U+1E9E) in Unicode rules is U+00DF (on ASCII platforms).   But under\n\"use locale\" (prior to v5.20 or not a UTF-8 locale), the lower case of U+1E9E is\nitself, because 0xDF may not be LATIN SMALL LETTER SHARP S in the current locale, and\nPerl has no way of knowing if that character even exists in the locale, much less\nwhat code point it is.  Perl returns a result that is above 255 (almost always the\ninput character unchanged), for all instances (and there aren't many) where the\n255/256 boundary would otherwise be crossed; and starting in v5.22, it raises a\nlocale warning.\n\nOtherwise, If EXPR has the UTF8 flag set:\nUnicode rules are used for the case change.\n\nOtherwise, if \"use feature 'unicodestrings'\" or \"use locale ':notcharacters'\" is in\neffect:\nUnicode rules are used for the case change.\n\nOtherwise:\nASCII rules are used for the case change.  The lowercase of any character outside the\nASCII range is the character itself.\n\nlcfirst EXPR\nlcfirst\nReturns the value of EXPR with the first character lowercased.  This is the internal\nfunction implementing the \"\\l\" escape in double-quoted strings.\n\nIf EXPR is omitted, uses $.\n\nThis function behaves the same way under various pragmas, such as in a locale, as \"lc\"\ndoes.\n\nlength EXPR\nlength\nReturns the length in characters of the value of EXPR.  If EXPR is omitted, returns the\nlength of $.  If EXPR is undefined, returns \"undef\".\n\nThis function cannot be used on an entire array or hash to find out how many elements\nthese have.  For that, use \"scalar @array\" and \"scalar keys %hash\", respectively.\n\nLike all Perl character operations, \"length\" normally deals in logical characters, not\nphysical bytes.  For how many bytes a string encoded as UTF-8 would take up, use\n\"length(Encode::encode('UTF-8', EXPR))\" (you'll have to \"use Encode\" first).  See Encode\nand perlunicode.\n\nLINE\nA special token that compiles to the current line number.  It can be altered by the\nmechanism described at \"Plain Old Comments (Not!)\" in perlsyn.\n\nlink OLDFILE,NEWFILE\nCreates a new filename linked to the old filename.  Returns true for success, false\notherwise.\n\nPortability issues: \"link\" in perlport.\n\nlisten SOCKET,QUEUESIZE\nDoes the same thing that the listen(2) system call does.  Returns true if it succeeded,\nfalse otherwise.  See the example in \"Sockets: Client/Server Communication\" in perlipc.\n\nlocal EXPR\nYou really probably want to be using \"my\" instead, because \"local\" isn't what most people\nthink of as \"local\".  See \"Private Variables via my()\" in perlsub for details.\n\nA local modifies the listed variables to be local to the enclosing block, file, or eval.\nIf more than one value is listed, the list must be placed in parentheses.  See \"Temporary\nValues via local()\" in perlsub for details, including issues with tied arrays and hashes.\n\nThe \"delete local EXPR\" construct can also be used to localize the deletion of array/hash\nelements to the current block.  See \"Localized deletion of elements of composite types\"\nin perlsub.\n\nlocaltime EXPR\nlocaltime\nConverts a time as returned by the time function to a 9-element list with the time\nanalyzed for the local time zone.  Typically used as follows:\n\n#     0    1    2     3     4    5     6     7     8\nmy ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =\nlocaltime(time);\n\nAll list elements are numeric and come straight out of the C `struct tm'.  $sec, $min,\nand $hour are the seconds, minutes, and hours of the specified time.\n\n$mday is the day of the month and $mon the month in the range 0..11, with 0 indicating\nJanuary and 11 indicating December.  This makes it easy to get a month name from a list:\n\nmy @abbr = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);\nprint \"$abbr[$mon] $mday\";\n# $mon=9, $mday=18 gives \"Oct 18\"\n\n$year contains the number of years since 1900.  To get a 4-digit year write:\n\n$year += 1900;\n\nTo get the last two digits of the year (e.g., \"01\" in 2001) do:\n\n$year = sprintf(\"%02d\", $year % 100);\n\n$wday is the day of the week, with 0 indicating Sunday and 3 indicating Wednesday.  $yday\nis the day of the year, in the range 0..364 (or 0..365 in leap years.)\n\n$isdst is true if the specified time occurs when Daylight Saving Time is in effect, false\notherwise.\n\nIf EXPR is omitted, \"localtime\" uses the current time (as returned by \"time\").\n\nIn scalar context, \"localtime\" returns the ctime(3) value:\n\nmy $nowstring = localtime;  # e.g., \"Thu Oct 13 04:54:34 1994\"\n\nThis scalar value is always in English, and is not locale-dependent.  To get similar but\nlocale-dependent date strings, try for example:\n\nuse POSIX qw(strftime);\nmy $nowstring = strftime \"%a %b %e %H:%M:%S %Y\", localtime;\n# or for GMT formatted appropriately for your locale:\nmy $nowstring = strftime \"%a %b %e %H:%M:%S %Y\", gmtime;\n\nC$nowstring> will be formatted according to the current LCTIME locale the program or\nthread is running in.  See perllocale for how to set up and change that locale.  Note\nthat %a and %b, the short forms of the day of the week and the month of the year, may not\nnecessarily be three characters wide.\n\nThe Time::gmtime and Time::localtime modules provide a convenient, by-name access\nmechanism to the \"gmtime\" and \"localtime\" functions, respectively.\n\nFor a comprehensive date and time representation look at the DateTime module on CPAN.\n\nFor GMT instead of local time use the \"gmtime\" builtin.\n\nSee also the \"Time::Local\" module (for converting seconds, minutes, hours, and such back\nto the integer value returned by \"time\"), and the POSIX module's \"mktime\" function.\n\nPortability issues: \"localtime\" in perlport.\n\nlock THING\nThis function places an advisory lock on a shared variable or referenced object contained\nin THING until the lock goes out of scope.\n\nThe value returned is the scalar itself, if the argument is a scalar, or a reference, if\nthe argument is a hash, array or subroutine.\n\n\"lock\" is a \"weak keyword\"; this means that if you've defined a function by this name\n(before any calls to it), that function will be called instead.  If you are not under\n\"use threads::shared\" this does nothing.  See threads::shared.\n\nlog EXPR\nlog Returns the natural logarithm (base e) of EXPR.  If EXPR is omitted, returns the log of\n$.  To get the log of another base, use basic algebra: The base-N log of a number is\nequal to the natural log of that number divided by the natural log of N.  For example:\n\nsub log10 {\nmy $n = shift;\nreturn log($n)/log(10);\n}\n\nSee also \"exp\" for the inverse operation.\n\nlstat FILEHANDLE\nlstat EXPR\nlstat DIRHANDLE\nlstat\nDoes the same thing as the \"stat\" function (including setting the special \"\" filehandle)\nbut stats a symbolic link instead of the file the symbolic link points to.  If symbolic\nlinks are unimplemented on your system, a normal \"stat\" is done.  For much more detailed\ninformation, please see the documentation for \"stat\".\n\nIf EXPR is omitted, stats $.\n\nPortability issues: \"lstat\" in perlport.\n\nm// The match operator.  See \"Regexp Quote-Like Operators\" in perlop.\n\nmap BLOCK LIST\nmap EXPR,LIST\nEvaluates the BLOCK or EXPR for each element of LIST (locally setting $ to each element)\nand composes a list of the results of each such evaluation.  Each element of LIST may\nproduce zero, one, or more elements in the generated list, so the number of elements in\nthe generated list may differ from that in LIST.  In scalar context, returns the total\nnumber of elements so generated.  In list context, returns the generated list.\n\nmy @chars = map(chr, @numbers);\n\ntranslates a list of numbers to the corresponding characters.\n\nmy @squares = map { $ * $ } @numbers;\n\ntranslates a list of numbers to their squared values.\n\nmy @squares = map { $ > 5 ? ($ * $) : () } @numbers;\n\nshows that number of returned elements can differ from the number of input elements.  To\nomit an element, return an empty list ().  This could also be achieved by writing\n\nmy @squares = map { $ * $ } grep { $ > 5 } @numbers;\n\nwhich makes the intention more clear.\n\nMap always returns a list, which can be assigned to a hash such that the elements become\nkey/value pairs.  See perldata for more details.\n\nmy %hash = map { getakeyfor($) => $ } @array;\n\nis just a funny way to write\n\nmy %hash;\nforeach (@array) {\n$hash{getakeyfor($)} = $;\n}\n\nNote that $ is an alias to the list value, so it can be used to modify the elements of\nthe LIST.  While this is useful and supported, it can cause bizarre results if the\nelements of LIST are not variables.  Using a regular \"foreach\" loop for this purpose\nwould be clearer in most cases.  See also \"grep\" for a list composed of those items of\nthe original list for which the BLOCK or EXPR evaluates to true.\n\n\"{\" starts both hash references and blocks, so \"map { ...\" could be either the start of\nmap BLOCK LIST or map EXPR, LIST.  Because Perl doesn't look ahead for the closing \"}\" it\nhas to take a guess at which it's dealing with based on what it finds just after the \"{\".\nUsually it gets it right, but if it doesn't it won't realize something is wrong until it\ngets to the \"}\" and encounters the missing (or unexpected) comma.  The syntax error will\nbe reported close to the \"}\", but you'll need to change something near the \"{\" such as\nusing a unary \"+\" or semicolon to give Perl some help:\n\nmy %hash = map {  \"\\L$\" => 1  } @array # perl guesses EXPR. wrong\nmy %hash = map { +\"\\L$\" => 1  } @array # perl guesses BLOCK. right\nmy %hash = map {; \"\\L$\" => 1  } @array # this also works\nmy %hash = map { (\"\\L$\" => 1) } @array # as does this\nmy %hash = map {  lc($) => 1  } @array # and this.\nmy %hash = map +( lc($) => 1 ), @array # this is EXPR and works!\n\nmy %hash = map  ( lc($), 1 ),   @array # evaluates to (1, @array)\n\nor to force an anon hash constructor use \"+{\":\n\nmy @hashes = map +{ lc($) => 1 }, @array # EXPR, so needs\n# comma at end\n\nto get a list of anonymous hashes each with only one entry apiece.\n\nmkdir FILENAME,MODE\nmkdir FILENAME\nmkdir\nCreates the directory specified by FILENAME, with permissions specified by MODE (as\nmodified by \"umask\").  If it succeeds it returns true; otherwise it returns false and\nsets $! (errno).  MODE defaults to 0777 if omitted, and FILENAME defaults to $ if\nomitted.\n\nIn general, it is better to create directories with a permissive MODE and let the user\nmodify that with their \"umask\" than it is to supply a restrictive MODE and give the user\nno way to be more permissive.  The exceptions to this rule are when the file or directory\nshould be kept private (mail files, for instance).  The documentation for \"umask\"\ndiscusses the choice of MODE in more detail.\n\nNote that according to the POSIX 1003.1-1996 the FILENAME may have any number of trailing\nslashes.  Some operating and filesystems do not get this right, so Perl automatically\nremoves all trailing slashes to keep everyone happy.\n\nTo recursively create a directory structure, look at the \"makepath\" function of the\nFile::Path module.\n\nmsgctl ID,CMD,ARG\nCalls the System V IPC function msgctl(2).  You'll probably have to say\n\nuse IPC::SysV;\n\nfirst to get the correct constant definitions.  If CMD is \"IPCSTAT\", then ARG must be a\nvariable that will hold the returned \"msqidds\" structure.  Returns like \"ioctl\": the\nundefined value for error, \"0 but true\" for zero, or the actual return value otherwise.\nSee also \"SysV IPC\" in perlipc and the documentation for \"IPC::SysV\" and\n\"IPC::Semaphore\".\n\nPortability issues: \"msgctl\" in perlport.\n\nmsgget KEY,FLAGS\nCalls the System V IPC function msgget(2).  Returns the message queue id, or \"undef\" on\nerror.  See also \"SysV IPC\" in perlipc and the documentation for \"IPC::SysV\" and\n\"IPC::Msg\".\n\nPortability issues: \"msgget\" in perlport.\n\nmsgrcv ID,VAR,SIZE,TYPE,FLAGS\nCalls the System V IPC function msgrcv to receive a message from message queue ID into\nvariable VAR with a maximum message size of SIZE.  Note that when a message is received,\nthe message type as a native long integer will be the first thing in VAR, followed by the\nactual message.  This packing may be opened with \"unpack(\"l! a*\")\".  Taints the variable.\nReturns true if successful, false on error.  See also \"SysV IPC\" in perlipc and the\ndocumentation for \"IPC::SysV\" and \"IPC::Msg\".\n\nPortability issues: \"msgrcv\" in perlport.\n\nmsgsnd ID,MSG,FLAGS\nCalls the System V IPC function msgsnd to send the message MSG to the message queue ID.\nMSG must begin with the native long integer message type, followed by the message itself.\nThis kind of packing can be achieved with \"pack(\"l! a*\", $type, $message)\".  Returns true\nif successful, false on error.  See also \"SysV IPC\" in perlipc and the documentation for\n\"IPC::SysV\" and \"IPC::Msg\".\n\nPortability issues: \"msgsnd\" in perlport.\n\nmy VARLIST\nmy TYPE VARLIST\nmy VARLIST : ATTRS\nmy TYPE VARLIST : ATTRS\nA \"my\" declares the listed variables to be local (lexically) to the enclosing block,\nfile, or \"eval\".  If more than one variable is listed, the list must be placed in\nparentheses.\n\nNote that with a parenthesised list, \"undef\" can be used as a dummy placeholder, for\nexample to skip assignment of initial values:\n\nmy ( undef, $min, $hour ) = localtime;\n\nRedeclaring a variable in the same scope or statement will \"shadow\" the previous\ndeclaration, creating a new instance and preventing access to the previous one. This is\nusually undesired and, if warnings are enabled, will result in a warning in the \"shadow\"\ncategory.\n\nThe exact semantics and interface of TYPE and ATTRS are still evolving.  TYPE may be a\nbareword, a constant declared with \"use constant\", or \"PACKAGE\".  It is currently\nbound to the use of the fields pragma, and attributes are handled using the attributes\npragma, or starting from Perl 5.8.0 also via the Attribute::Handlers module.  See\n\"Private Variables via my()\" in perlsub for details.\n\nnext LABEL\nnext EXPR\nnext\nThe \"next\" command is like the \"continue\" statement in C; it starts the next iteration of\nthe loop:\n\nLINE: while (<STDIN>) {\nnext LINE if /^#/;  # discard comments\n#...\n}\n\nNote that if there were a \"continue\" block on the above, it would get executed even on\ndiscarded lines.  If LABEL is omitted, the command refers to the innermost enclosing\nloop.  The \"next EXPR\" form, available as of Perl 5.18.0, allows a label name to be\ncomputed at run time, being otherwise identical to \"next LABEL\".\n\n\"next\" cannot return a value from a block that typically returns a value, such as \"eval\n{}\", \"sub {}\", or \"do {}\". It will perform its flow control behavior, which precludes any\nreturn value. It should not be used to exit a \"grep\" or \"map\" operation.\n\nNote that a block by itself is semantically identical to a loop that executes once.  Thus\n\"next\" will exit such a block early.\n\nSee also \"continue\" for an illustration of how \"last\", \"next\", and \"redo\" work.\n\nUnlike most named operators, this has the same precedence as assignment.  It is also\nexempt from the looks-like-a-function rule, so \"next (\"foo\").\"bar\"\" will cause \"bar\" to\nbe part of the argument to \"next\".\n\nno MODULE VERSION LIST\nno MODULE VERSION\nno MODULE LIST\nno MODULE\nno VERSION\nSee the \"use\" function, of which \"no\" is the opposite.\n\noct EXPR\noct Interprets EXPR as an octal string and returns the corresponding value.  An octal string\nconsists of octal digits and, as of Perl 5.33.5, an optional \"0o\" or \"o\" prefix.  Each\noctal digit may be preceded by a single underscore, which will be ignored.  (If EXPR\nhappens to start off with \"0x\" or \"x\", interprets it as a hex string.  If EXPR starts off\nwith \"0b\" or \"b\", it is interpreted as a binary string.  Leading whitespace is ignored in\nall three cases.)  The following will handle decimal, binary, octal, and hex in standard\nPerl notation:\n\n$val = oct($val) if $val =~ /^0/;\n\nIf EXPR is omitted, uses $.   To go the other way (produce a number in octal), use\n\"sprintf\" or \"printf\":\n\nmy $decperms = (stat(\"filename\"))[2] & 07777;\nmy $octpermstr = sprintf \"%o\", $perms;\n\nThe \"oct\" function is commonly used when a string such as 644 needs to be converted into\na file mode, for example.  Although Perl automatically converts strings into numbers as\nneeded, this automatic conversion assumes base 10.\n\nLeading white space is ignored without warning, as too are any trailing non-digits, such\nas a decimal point (\"oct\" only handles non-negative integers, not negative integers or\nfloating point).\n\nopen FILEHANDLE,MODE,EXPR\nopen FILEHANDLE,MODE,EXPR,LIST\nopen FILEHANDLE,MODE,REFERENCE\nopen FILEHANDLE,EXPR\nopen FILEHANDLE\nAssociates an internal FILEHANDLE with the external file specified by EXPR. That\nfilehandle will subsequently allow you to perform I/O operations on that file, such as\nreading from it or writing to it.\n\nInstead of a filename, you may specify an external command (plus an optional argument\nlist) or a scalar reference, in order to open filehandles on commands or in-memory\nscalars, respectively.\n\nA thorough reference to \"open\" follows. For a gentler introduction to the basics of\n\"open\", see also the perlopentut manual page.\n\nWorking with files\nMost often, \"open\" gets invoked with three arguments: the required FILEHANDLE\n(usually an empty scalar variable), followed by MODE (usually a literal describing\nthe I/O mode the filehandle will use), and then the filename  that the new filehandle\nwill refer to.\n\nSimple examples\nReading from a file:\n\nopen(my $fh, \"<\", \"input.txt\")\nor die \"Can't open < input.txt: $!\";\n\n# Process every line in input.txt\nwhile (my $line = <$fh>) {\n#\n# ... do something interesting with $line here ...\n#\n}\n\nor writing to one:\n\nopen(my $fh, \">\", \"output.txt\")\nor die \"Can't open > output.txt: $!\";\n\nprint $fh \"This line gets printed into output.txt.\\n\";\n\nFor a summary of common filehandle operations such as these, see \"Files and I/O\"\nin perlintro.\n\nAbout filehandles\nThe first argument to \"open\", labeled FILEHANDLE in this reference, is usually a\nscalar variable. (Exceptions exist, described in \"Other considerations\", below.)\nIf the call to \"open\" succeeds, then the expression provided as FILEHANDLE will\nget assigned an open filehandle. That filehandle provides an internal reference\nto the specified external file, conveniently stored in a Perl variable, and ready\nfor I/O operations such as reading and writing.\n\nAbout modes\nWhen calling \"open\" with three or more arguments, the second argument -- labeled\nMODE here -- defines the open mode. MODE is usually a literal string comprising\nspecial characters that define the intended I/O role of the filehandle being\ncreated: whether it's read-only, or read-and-write, and so on.\n\nIf MODE is \"<\", the file is opened for input (read-only).  If MODE is \">\", the\nfile is opened for output, with existing files first being truncated\n(\"clobbered\") and nonexisting files newly created.  If MODE is \">>\", the file is\nopened for appending, again being created if necessary.\n\nYou can put a \"+\" in front of the \">\" or \"<\" to indicate that you want both read\nand write access to the file; thus \"+<\" is almost always preferred for read/write\nupdates--the \"+>\" mode would clobber the file first.  You can't usually use\neither read-write mode for updating textfiles, since they have variable-length\nrecords.  See the -i switch in perlrun for a better approach.  The file is\ncreated with permissions of 0666 modified by the process's \"umask\" value.\n\nThese various prefixes correspond to the fopen(3) modes of \"r\", \"r+\", \"w\", \"w+\",\n\"a\", and \"a+\".\n\nMore examples of different modes in action:\n\n# Open a file for concatenation\nopen(my $log, \">>\", \"/usr/spool/news/twitlog\")\nor warn \"Couldn't open log file; discarding input\";\n\n# Open a file for reading and writing\nopen(my $dbase, \"+<\", \"dbase.mine\")\nor die \"Can't open 'dbase.mine' for update: $!\";\n\nChecking the return value\nOpen returns nonzero on success, the undefined value otherwise.  If the \"open\"\ninvolved a pipe, the return value happens to be the pid of the subprocess.\n\nWhen opening a file, it's seldom a good idea to continue if the request failed,\nso \"open\" is frequently used with \"die\". Even if you want your code to do\nsomething other than \"die\" on a failed open, you should still always check the\nreturn value from opening a file.\n\nSpecifying I/O layers in MODE\nYou can use the three-argument form of open to specify I/O layers (sometimes referred\nto as \"disciplines\") to apply to the new filehandle. These affect how the input and\noutput are processed (see open and PerlIO for more details).  For example:\n\nopen(my $fh, \"<:encoding(UTF-8)\", $filename)\n|| die \"Can't open UTF-8 encoded $filename: $!\";\n\nThis opens the UTF8-encoded file containing Unicode characters; see perluniintro.\nNote that if layers are specified in the three-argument form, then default layers\nstored in \"${^OPEN}\" (usually set by the open pragma or the switch \"-CioD\") are\nignored.  Those layers will also be ignored if you specify a colon with no name\nfollowing it.  In that case the default layer for the operating system (:raw on Unix,\n:crlf on Windows) is used.\n\nOn some systems (in general, DOS- and Windows-based systems) \"binmode\" is necessary\nwhen you're not working with a text file.  For the sake of portability it is a good\nidea always to use it when appropriate, and never to use it when it isn't\nappropriate.  Also, people can set their I/O to be by default UTF8-encoded Unicode,\nnot bytes.\n\nUsing \"undef\" for temporary files\nAs a special case the three-argument form with a read/write mode and the third\nargument being \"undef\":\n\nopen(my $tmp, \"+>\", undef) or die ...\n\nopens a filehandle to a newly created empty anonymous temporary file.  (This happens\nunder any mode, which makes \"+>\" the only useful and sensible mode to use.)  You will\nneed to \"seek\" to do the reading.\n\nOpening a filehandle into an in-memory scalar\nYou can open filehandles directly to Perl scalars instead of a file or other resource\nexternal to the program. To do so, provide a reference to that scalar as the third\nargument to \"open\", like so:\n\nopen(my $memory, \">\", \\$var)\nor die \"Can't open memory file: $!\";\nprint $memory \"foo!\\n\";    # output will appear in $var\n\nTo (re)open \"STDOUT\" or \"STDERR\" as an in-memory file, close it first:\n\nclose STDOUT;\nopen(STDOUT, \">\", \\$variable)\nor die \"Can't open STDOUT: $!\";\n\nThe scalars for in-memory files are treated as octet strings: unless the file is\nbeing opened with truncation the scalar may not contain any code points over 0xFF.\n\nOpening in-memory files can fail for a variety of reasons.  As with any other \"open\",\ncheck the return value for success.\n\nTechnical note: This feature works only when Perl is built with PerlIO -- the\ndefault, except with older (pre-5.16) Perl installations that were configured to not\ninclude it (e.g. via \"Configure -Uuseperlio\"). You can see whether your Perl was\nbuilt with PerlIO by running \"perl -V:useperlio\".  If it says 'define', you have\nPerlIO; otherwise you don't.\n\nSee perliol for detailed info on PerlIO.\n\nOpening a filehandle into a command\nIf MODE is \"|-\", then the filename is interpreted as a command to which output is to\nbe piped, and if MODE is \"-|\", the filename is interpreted as a command that pipes\noutput to us.  In the two-argument (and one-argument) form, one should replace dash\n(\"-\") with the command.  See \"Using open() for IPC\" in perlipc for more examples of\nthis.  (You are not allowed to \"open\" to a command that pipes both in and out, but\nsee IPC::Open2, IPC::Open3, and \"Bidirectional Communication with Another Process\" in\nperlipc for alternatives.)\n\nopen(my $articlefh, \"-|\", \"caesar <$article\")  # decrypt\n# article\nor die \"Can't start caesar: $!\";\n\nopen(my $articlefh, \"caesar <$article |\")      # ditto\nor die \"Can't start caesar: $!\";\n\nopen(my $outfh, \"|-\", \"sort >Tmp$$\")    # $$ is our process id\nor die \"Can't start sort: $!\";\n\nIn the form of pipe opens taking three or more arguments, if LIST is specified (extra\narguments after the command name) then LIST becomes arguments to the command invoked\nif the platform supports it.  The meaning of \"open\" with more than three arguments\nfor non-pipe modes is not yet defined, but experimental \"layers\" may give extra LIST\narguments meaning.\n\nIf you open a pipe on the command \"-\" (that is, specify either \"|-\" or \"-|\" with the\none- or two-argument forms of \"open\"), an implicit \"fork\" is done, so \"open\" returns\ntwice: in the parent process it returns the pid of the child process, and in the\nchild process it returns (a defined) 0.  Use \"defined($pid)\" or \"//\" to determine\nwhether the open was successful.\n\nFor example, use either\n\nmy $childpid = open(my $fromkid, \"-|\")\n// die \"Can't fork: $!\";\n\nor\n\nmy $childpid = open(my $tokid,   \"|-\")\n// die \"Can't fork: $!\";\n\nfollowed by\n\nif ($childpid) {\n# am the parent:\n# either write $tokid or else read $fromkid\n...\nwaitpid $childpid, 0;\n} else {\n# am the child; use STDIN/STDOUT normally\n...\nexit;\n}\n\nThe filehandle behaves normally for the parent, but I/O to that filehandle is piped\nfrom/to the STDOUT/STDIN of the child process.  In the child process, the filehandle\nisn't opened--I/O happens from/to the new STDOUT/STDIN.  Typically this is used like\nthe normal piped open when you want to exercise more control over just how the pipe\ncommand gets executed, such as when running setuid and you don't want to have to scan\nshell commands for metacharacters.\n\nThe following blocks are more or less equivalent:\n\nopen(my $fh, \"|tr '[a-z]' '[A-Z]'\");\nopen(my $fh, \"|-\", \"tr '[a-z]' '[A-Z]'\");\nopen(my $fh, \"|-\") || exec 'tr', '[a-z]', '[A-Z]';\nopen(my $fh, \"|-\", \"tr\", '[a-z]', '[A-Z]');\n\nopen(my $fh, \"cat -n '$file'|\");\nopen(my $fh, \"-|\", \"cat -n '$file'\");\nopen(my $fh, \"-|\") || exec \"cat\", \"-n\", $file;\nopen(my $fh, \"-|\", \"cat\", \"-n\", $file);\n\nThe last two examples in each block show the pipe as \"list form\", which is not yet\nsupported on all platforms. (If your platform has a real \"fork\", such as Linux and\nmacOS, you can use the list form; it also works on Windows with Perl 5.22 or later.)\nYou would want to use the list form of the pipe so you can pass literal arguments to\nthe command without risk of the shell interpreting any shell metacharacters in them.\nHowever, this also bars you from opening pipes to commands that intentionally contain\nshell metacharacters, such as:\n\nopen(my $fh, \"|cat -n | expand -4 | lpr\")\n|| die \"Can't open pipeline to lpr: $!\";\n\nSee \"Safe Pipe Opens\" in perlipc for more examples of this.\n\nDuping filehandles\nYou may also, in the Bourne shell tradition, specify an EXPR beginning with \">&\", in\nwhich case the rest of the string is interpreted as the name of a filehandle (or file\ndescriptor, if numeric) to be duped (as in dup(2)) and opened.  You may use \"&\" after\n\">\", \">>\", \"<\", \"+>\", \"+>>\", and \"+<\".  The mode you specify should match the mode of\nthe original filehandle.  (Duping a filehandle does not take into account any\nexisting contents of IO buffers.)  If you use the three-argument form, then you can\npass either a number, the name of a filehandle, or the normal \"reference to a glob\".\n\nHere is a script that saves, redirects, and restores \"STDOUT\" and \"STDERR\" using\nvarious methods:\n\n#!/usr/bin/perl\nopen(my $oldout, \">&STDOUT\")\nor die \"Can't dup STDOUT: $!\";\nopen(OLDERR,     \">&\", \\*STDERR)\nor die \"Can't dup STDERR: $!\";\n\nopen(STDOUT, '>', \"foo.out\")\nor die \"Can't redirect STDOUT: $!\";\nopen(STDERR, \">&STDOUT\")\nor die \"Can't dup STDOUT: $!\";\n\nselect STDERR; $| = 1;  # make unbuffered\nselect STDOUT; $| = 1;  # make unbuffered\n\nprint STDOUT \"stdout 1\\n\";  # this works for\nprint STDERR \"stderr 1\\n\";  # subprocesses too\n\nopen(STDOUT, \">&\", $oldout)\nor die \"Can't dup \\$oldout: $!\";\nopen(STDERR, \">&OLDERR\")\nor die \"Can't dup OLDERR: $!\";\n\nprint STDOUT \"stdout 2\\n\";\nprint STDERR \"stderr 2\\n\";\n\nIf you specify '<&=X', where \"X\" is a file descriptor number or a filehandle, then\nPerl will do an equivalent of C's fdopen(3) of that file descriptor (and not call\ndup(2)); this is more parsimonious of file descriptors.  For example:\n\n# open for input, reusing the fileno of $fd\nopen(my $fh, \"<&=\", $fd)\n\nor\n\nopen(my $fh, \"<&=$fd\")\n\nor\n\n# open for append, using the fileno of $oldfh\nopen(my $fh, \">>&=\", $oldfh)\n\nBeing parsimonious on filehandles is also useful (besides being parsimonious) for\nexample when something is dependent on file descriptors, like for example locking\nusing \"flock\".  If you do just \"open(my $A, \">>&\", $B)\", the filehandle $A will not\nhave the same file descriptor as $B, and therefore \"flock($A)\" will not \"flock($B)\"\nnor vice versa.  But with \"open(my $A, \">>&=\", $B)\", the filehandles will share the\nsame underlying system file descriptor.\n\nNote that under Perls older than 5.8.0, Perl uses the standard C library's' fdopen(3)\nto implement the \"=\" functionality.  On many Unix systems, fdopen(3) fails when file\ndescriptors exceed a certain value, typically 255.  For Perls 5.8.0 and later, PerlIO\nis (most often) the default.\n\nLegacy usage\nThis section describes ways to call \"open\" outside of best practices; you may\nencounter these uses in older code. Perl does not consider their use deprecated,\nexactly, but neither is it recommended in new code, for the sake of clarity and\nreadability.\n\nSpecifying mode and filename as a single argument\nIn the one- and two-argument forms of the call, the mode and filename should be\nconcatenated (in that order), preferably separated by white space.  You can--but\nshouldn't--omit the mode in these forms when that mode is \"<\".  It is safe to use\nthe two-argument form of \"open\" if the filename argument is a known literal.\n\nopen(my $dbase, \"+<dbase.mine\")          # ditto\nor die \"Can't open 'dbase.mine' for update: $!\";\n\nIn the two-argument (and one-argument) form, opening \"<-\" or \"-\" opens STDIN and\nopening \">-\" opens STDOUT.\n\nNew code should favor the three-argument form of \"open\" over this older form.\nDeclaring the mode and the filename as two distinct arguments avoids any\nconfusion between the two.\n\nCalling \"open\" with one argument via global variables\nAs a shortcut, a one-argument call takes the filename from the global scalar\nvariable of the same name as the filehandle:\n\n$ARTICLE = 100;\nopen(ARTICLE)\nor die \"Can't find article $ARTICLE: $!\\n\";\n\nHere $ARTICLE must be a global (package) scalar variable - not one declared with\n\"my\" or \"state\".\n\nAssigning a filehandle to a bareword\nAn older style is to use a bareword as the filehandle, as\n\nopen(FH, \"<\", \"input.txt\")\nor die \"Can't open < input.txt: $!\";\n\nThen you can use \"FH\" as the filehandle, in \"close FH\" and \"<FH>\" and so on.\nNote that it's a global variable, so this form is not recommended when dealing\nwith filehandles other than Perl's built-in ones (e.g. STDOUT and STDIN).\n\nOther considerations\nAutomatic filehandle closure\nThe filehandle will be closed when its reference count reaches zero. If it is a\nlexically scoped variable declared with \"my\", that usually means the end of the\nenclosing scope.  However, this automatic close does not check for errors, so it\nis better to explicitly close filehandles, especially those used for writing:\n\nclose($handle)\n|| warn \"close failed: $!\";\n\nAutomatic pipe flushing\nPerl will attempt to flush all files opened for output before any operation that\nmay do a fork, but this may not be supported on some platforms (see perlport).\nTo be safe, you may need to set $| ($AUTOFLUSH in English) or call the\n\"autoflush\" method of \"IO::Handle\" on any open handles.\n\nOn systems that support a close-on-exec flag on files, the flag will be set for\nthe newly opened file descriptor as determined by the value of $^F.  See \"$^F\" in\nperlvar.\n\nClosing any piped filehandle causes the parent process to wait for the child to\nfinish, then returns the status value in $? and \"${^CHILDERRORNATIVE}\".\n\nDirect versus by-reference assignment of filehandles\nIf FILEHANDLE -- the first argument in a call to \"open\" -- is an undefined scalar\nvariable (or array or hash element), a new filehandle is autovivified, meaning\nthat the variable is assigned a reference to a newly allocated anonymous\nfilehandle.  Otherwise if FILEHANDLE is an expression, its value is the real\nfilehandle.  (This is considered a symbolic reference, so \"use strict \"refs\"\"\nshould not be in effect.)\n\nWhitespace and special characters in the filename argument\nThe filename passed to the one- and two-argument forms of \"open\" will have\nleading and trailing whitespace deleted and normal redirection characters\nhonored.  This property, known as \"magic open\", can often be used to good effect.\nA user could specify a filename of \"rsh cat file |\", or you could change certain\nfilenames as needed:\n\n$filename =~ s/(.*\\.gz)\\s*$/gzip -dc < $1|/;\nopen(my $fh, $filename)\nor die \"Can't open $filename: $!\";\n\nUse the three-argument form to open a file with arbitrary weird characters in it,\n\nopen(my $fh, \"<\", $file)\n|| die \"Can't open $file: $!\";\n\notherwise it's necessary to protect any leading and trailing whitespace:\n\n$file =~ s#^(\\s)#./$1#;\nopen(my $fh, \"< $file\\0\")\n|| die \"Can't open $file: $!\";\n\n(this may not work on some bizarre filesystems).  One should conscientiously\nchoose between the magic and three-argument form of \"open\":\n\nopen(my $in, $ARGV[0]) || die \"Can't open $ARGV[0]: $!\";\n\nwill allow the user to specify an argument of the form \"rsh cat file |\", but will\nnot work on a filename that happens to have a trailing space, while\n\nopen(my $in, \"<\", $ARGV[0])\n|| die \"Can't open $ARGV[0]: $!\";\n\nwill have exactly the opposite restrictions. (However, some shells support the\nsyntax \"perl yourprogram.pl <( rsh cat file )\", which produces a filename that\ncan be opened normally.)\n\nInvoking C-style \"open\"\nIf you want a \"real\" C open(2), then you should use the \"sysopen\" function, which\ninvolves no such magic (but uses different filemodes than Perl \"open\", which\ncorresponds to C fopen(3)).  This is another way to protect your filenames from\ninterpretation.  For example:\n\nuse IO::Handle;\nsysopen(my $fh, $path, ORDWR|OCREAT|OEXCL)\nor die \"Can't open $path: $!\";\n$fh->autoflush(1);\nprint $fh \"stuff $$\\n\";\nseek($fh, 0, 0);\nprint \"File contains: \", readline($fh);\n\nSee \"seek\" for some details about mixing reading and writing.\n\nPortability issues\nSee \"open\" in perlport.\n\nopendir DIRHANDLE,EXPR\nOpens a directory named EXPR for processing by \"readdir\", \"telldir\", \"seekdir\",\n\"rewinddir\", and \"closedir\".  Returns true if successful.  DIRHANDLE may be an expression\nwhose value can be used as an indirect dirhandle, usually the real dirhandle name.  If\nDIRHANDLE is an undefined scalar variable (or array or hash element), the variable is\nassigned a reference to a new anonymous dirhandle; that is, it's autovivified.\nDirhandles are the same objects as filehandles; an I/O object can only be open as one of\nthese handle types at once.\n\nSee the example at \"readdir\".\n\nord EXPR\nord Returns the numeric value of the first character of EXPR.  If EXPR is an empty string,\nreturns 0.  If EXPR is omitted, uses $.  (Note character, not byte.)\n\nFor the reverse, see \"chr\".  See perlunicode for more about Unicode.\n\nour VARLIST\nour TYPE VARLIST\nour VARLIST : ATTRS\nour TYPE VARLIST : ATTRS\n\"our\" makes a lexical alias to a package (i.e. global) variable of the same name in the\ncurrent package for use within the current lexical scope.\n\n\"our\" has the same scoping rules as \"my\" or \"state\", meaning that it is only valid within\na lexical scope.  Unlike \"my\" and \"state\", which both declare new (lexical) variables,\n\"our\" only creates an alias to an existing variable: a package variable of the same name.\n\nThis means that when \"use strict 'vars'\" is in effect, \"our\" lets you use a package\nvariable without qualifying it with the package name, but only within the lexical scope\nof the \"our\" declaration.  This applies immediately--even within the same statement.\n\npackage Foo;\nuse strict;\n\n$Foo::foo = 23;\n\n{\nour $foo;   # alias to $Foo::foo\nprint $foo; # prints 23\n}\n\nprint $Foo::foo; # prints 23\n\nprint $foo; # ERROR: requires explicit package name\n\nThis works even if the package variable has not been used before, as package variables\nspring into existence when first used.\n\npackage Foo;\nuse strict;\n\nour $foo = 23;   # just like $Foo::foo = 23\n\nprint $Foo::foo; # prints 23\n\nBecause the variable becomes legal immediately under \"use strict 'vars'\", so long as\nthere is no variable with that name is already in scope, you can then reference the\npackage variable again even within the same statement.\n\npackage Foo;\nuse strict;\n\nmy  $foo = $foo; # error, undeclared $foo on right-hand side\nour $foo = $foo; # no errors\n\nIf more than one variable is listed, the list must be placed in parentheses.\n\nour($bar, $baz);\n\nAn \"our\" declaration declares an alias for a package variable that will be visible across\nits entire lexical scope, even across package boundaries.  The package in which the\nvariable is entered is determined at the point of the declaration, not at the point of\nuse.  This means the following behavior holds:\n\npackage Foo;\nour $bar;      # declares $Foo::bar for rest of lexical scope\n$bar = 20;\n\npackage Bar;\nprint $bar;    # prints 20, as it refers to $Foo::bar\n\nMultiple \"our\" declarations with the same name in the same lexical scope are allowed if\nthey are in different packages.  If they happen to be in the same package, Perl will emit\nwarnings if you have asked for them, just like multiple \"my\" declarations.  Unlike a\nsecond \"my\" declaration, which will bind the name to a fresh variable, a second \"our\"\ndeclaration in the same package, in the same scope, is merely redundant.\n\nuse warnings;\npackage Foo;\nour $bar;      # declares $Foo::bar for rest of lexical scope\n$bar = 20;\n\npackage Bar;\nour $bar = 30; # declares $Bar::bar for rest of lexical scope\nprint $bar;    # prints 30\n\nour $bar;      # emits warning but has no other effect\nprint $bar;    # still prints 30\n\nAn \"our\" declaration may also have a list of attributes associated with it.\n\nThe exact semantics and interface of TYPE and ATTRS are still evolving.  TYPE is\ncurrently bound to the use of the fields pragma, and attributes are handled using the\nattributes pragma, or, starting from Perl 5.8.0, also via the Attribute::Handlers module.\nSee \"Private Variables via my()\" in perlsub for details.\n\nNote that with a parenthesised list, \"undef\" can be used as a dummy placeholder, for\nexample to skip assignment of initial values:\n\nour ( undef, $min, $hour ) = localtime;\n\n\"our\" differs from \"use vars\", which allows use of an unqualified name only within the\naffected package, but across scopes.\n\npack TEMPLATE,LIST\nTakes a LIST of values and converts it into a string using the rules given by the\nTEMPLATE.  The resulting string is the concatenation of the converted values.  Typically,\neach converted value looks like its machine-level representation.  For example, on 32-bit\nmachines an integer may be represented by a sequence of 4 bytes, which  will in Perl be\npresented as a string that's 4 characters long.\n\nSee perlpacktut for an introduction to this function.\n\nThe TEMPLATE is a sequence of characters that give the order and type of values, as\nfollows:\n\na  A string with arbitrary binary data, will be null padded.\nA  A text (ASCII) string, will be space padded.\nZ  A null-terminated (ASCIZ) string, will be null padded.\n\nb  A bit string (ascending bit order inside each byte,\nlike vec()).\nB  A bit string (descending bit order inside each byte).\nh  A hex string (low nybble first).\nH  A hex string (high nybble first).\n\nc  A signed char (8-bit) value.\nC  An unsigned char (octet) value.\nW  An unsigned char value (can be greater than 255).\n\ns  A signed short (16-bit) value.\nS  An unsigned short value.\n\nl  A signed long (32-bit) value.\nL  An unsigned long value.\n\nq  A signed quad (64-bit) value.\nQ  An unsigned quad value.\n(Quads are available only if your system supports 64-bit\ninteger values and if Perl has been compiled to support\nthose.  Raises an exception otherwise.)\n\ni  A signed integer value.\nI  An unsigned integer value.\n(This 'integer' is atleast 32 bits wide.  Its exact\nsize depends on what a local C compiler calls 'int'.)\n\nn  An unsigned short (16-bit) in \"network\" (big-endian) order.\nN  An unsigned long (32-bit) in \"network\" (big-endian) order.\nv  An unsigned short (16-bit) in \"VAX\" (little-endian) order.\nV  An unsigned long (32-bit) in \"VAX\" (little-endian) order.\n\nj  A Perl internal signed integer value (IV).\nJ  A Perl internal unsigned integer value (UV).\n\nf  A single-precision float in native format.\nd  A double-precision float in native format.\n\nF  A Perl internal floating-point value (NV) in native format\nD  A float of long-double precision in native format.\n(Long doubles are available only if your system supports\nlong double values. Raises an exception otherwise.\nNote that there are different long double formats.)\n\np  A pointer to a null-terminated string.\nP  A pointer to a structure (fixed-length string).\n\nu  A uuencoded string.\nU  A Unicode character number.  Encodes to a character in char-\nacter mode and UTF-8 (or UTF-EBCDIC in EBCDIC platforms) in\nbyte mode.\n\nw  A BER compressed integer (not an ASN.1 BER, see perlpacktut\nfor details).  Its bytes represent an unsigned integer in\nbase 128, most significant digit first, with as few digits\nas possible.  Bit eight (the high bit) is set on each byte\nexcept the last.\n\nx  A null byte (a.k.a ASCII NUL, \"\\000\", chr(0))\nX  Back up a byte.\n@  Null-fill or truncate to absolute position, counted from the\nstart of the innermost ()-group.\n.  Null-fill or truncate to absolute position specified by\nthe value.\n(  Start of a ()-group.\n\nOne or more modifiers below may optionally follow certain letters in the TEMPLATE (the\nsecond column lists letters for which the modifier is valid):\n\n!   sSlLiI     Forces native (short, long, int) sizes instead\nof fixed (16-/32-bit) sizes.\n\n!   xX         Make x and X act as alignment commands.\n\n!   nNvV       Treat integers as signed instead of unsigned.\n\n!   @.         Specify position as byte offset in the internal\nrepresentation of the packed string.  Efficient\nbut dangerous.\n\n>   sSiIlLqQ   Force big-endian byte-order on the type.\njJfFdDpP   (The \"big end\" touches the construct.)\n\n<   sSiIlLqQ   Force little-endian byte-order on the type.\njJfFdDpP   (The \"little end\" touches the construct.)\n\nThe \">\" and \"<\" modifiers can also be used on \"()\" groups to force a particular byte-\norder on all components in that group, including all its subgroups.\n\nThe following rules apply:\n\n•   Each letter may optionally be followed by a number indicating the repeat count.  A\nnumeric repeat count may optionally be enclosed in brackets, as in \"pack(\"C[80]\",\n@arr)\".  The repeat count gobbles that many values from the LIST when used with all\nformat types other than \"a\", \"A\", \"Z\", \"b\", \"B\", \"h\", \"H\", \"@\", \".\", \"x\", \"X\", and\n\"P\", where it means something else, described below.  Supplying a \"*\" for the repeat\ncount instead of a number means to use however many items are left, except for:\n\n•   \"@\", \"x\", and \"X\", where it is equivalent to 0.\n\n•   <.>, where it means relative to the start of the string.\n\n•   \"u\", where it is equivalent to 1 (or 45, which here is equivalent).\n\nOne can replace a numeric repeat count with a template letter enclosed in brackets to\nuse the packed byte length of the bracketed template for the repeat count.\n\nFor example, the template \"x[L]\" skips as many bytes as in a packed long, and the\ntemplate \"$t X[$t] $t\" unpacks twice whatever $t (when variable-expanded) unpacks.\nIf the template in brackets contains alignment commands (such as \"x![d]\"), its packed\nlength is calculated as if the start of the template had the maximal possible\nalignment.\n\nWhen used with \"Z\", a \"*\" as the repeat count is guaranteed to add a trailing null\nbyte, so the resulting string is always one byte longer than the byte length of the\nitem itself.\n\nWhen used with \"@\", the repeat count represents an offset from the start of the\ninnermost \"()\" group.\n\nWhen used with \".\", the repeat count determines the starting position to calculate\nthe value offset as follows:\n\n•   If the repeat count is 0, it's relative to the current position.\n\n•   If the repeat count is \"*\", the offset is relative to the start of the packed\nstring.\n\n•   And if it's an integer n, the offset is relative to the start of the nth\ninnermost \"( )\" group, or to the start of the string if n is bigger then the\ngroup level.\n\nThe repeat count for \"u\" is interpreted as the maximal number of bytes to encode per\nline of output, with 0, 1 and 2 replaced by 45.  The repeat count should not be more\nthan 65.\n\n•   The \"a\", \"A\", and \"Z\" types gobble just one value, but pack it as a string of length\ncount, padding with nulls or spaces as needed.  When unpacking, \"A\" strips trailing\nwhitespace and nulls, \"Z\" strips everything after the first null, and \"a\" returns\ndata with no stripping at all.\n\nIf the value to pack is too long, the result is truncated.  If it's too long and an\nexplicit count is provided, \"Z\" packs only \"$count-1\" bytes, followed by a null byte.\nThus \"Z\" always packs a trailing null, except when the count is 0.\n\n•   Likewise, the \"b\" and \"B\" formats pack a string that's that many bits long.  Each\nsuch format generates 1 bit of the result.  These are typically followed by a repeat\ncount like \"B8\" or \"B64\".\n\nEach result bit is based on the least-significant bit of the corresponding input\ncharacter, i.e., on \"ord($char)%2\".  In particular, characters \"0\" and \"1\" generate\nbits 0 and 1, as do characters \"\\000\" and \"\\001\".\n\nStarting from the beginning of the input string, each 8-tuple of characters is\nconverted to 1 character of output.  With format \"b\", the first character of the\n8-tuple determines the least-significant bit of a character; with format \"B\", it\ndetermines the most-significant bit of a character.\n\nIf the length of the input string is not evenly divisible by 8, the remainder is\npacked as if the input string were padded by null characters at the end.  Similarly\nduring unpacking, \"extra\" bits are ignored.\n\nIf the input string is longer than needed, remaining characters are ignored.\n\nA \"*\" for the repeat count uses all characters of the input field.  On unpacking,\nbits are converted to a string of 0s and 1s.\n\n•   The \"h\" and \"H\" formats pack a string that many nybbles (4-bit groups, representable\nas hexadecimal digits, \"0\"..\"9\" \"a\"..\"f\") long.\n\nFor each such format, \"pack\" generates 4 bits of result.  With non-alphabetical\ncharacters, the result is based on the 4 least-significant bits of the input\ncharacter, i.e., on \"ord($char)%16\".  In particular, characters \"0\" and \"1\" generate\nnybbles 0 and 1, as do bytes \"\\000\" and \"\\001\".  For characters \"a\"..\"f\" and\n\"A\"..\"F\", the result is compatible with the usual hexadecimal digits, so that \"a\" and\n\"A\" both generate the nybble \"0xA==10\".  Use only these specific hex characters with\nthis format.\n\nStarting from the beginning of the template to \"pack\", each pair of characters is\nconverted to 1 character of output.  With format \"h\", the first character of the pair\ndetermines the least-significant nybble of the output character; with format \"H\", it\ndetermines the most-significant nybble.\n\nIf the length of the input string is not even, it behaves as if padded by a null\ncharacter at the end.  Similarly, \"extra\" nybbles are ignored during unpacking.\n\nIf the input string is longer than needed, extra characters are ignored.\n\nA \"*\" for the repeat count uses all characters of the input field.  For \"unpack\",\nnybbles are converted to a string of hexadecimal digits.\n\n•   The \"p\" format packs a pointer to a null-terminated string.  You are responsible for\nensuring that the string is not a temporary value, as that could potentially get\ndeallocated before you got around to using the packed result.  The \"P\" format packs a\npointer to a structure of the size indicated by the length.  A null pointer is\ncreated if the corresponding value for \"p\" or \"P\" is \"undef\"; similarly with\n\"unpack\", where a null pointer unpacks into \"undef\".\n\nIf your system has a strange pointer size--meaning a pointer is neither as big as an\nint nor as big as a long--it may not be possible to pack or unpack pointers in big-\nor little-endian byte order.  Attempting to do so raises an exception.\n\n•   The \"/\" template character allows packing and unpacking of a sequence of items where\nthe packed structure contains a packed item count followed by the packed items\nthemselves.  This is useful when the structure you're unpacking has encoded the sizes\nor repeat counts for some of its fields within the structure itself as separate\nfields.\n\nFor \"pack\", you write length-item\"/\"sequence-item, and the length-item describes how\nthe length value is packed.  Formats likely to be of most use are integer-packing\nones like \"n\" for Java strings, \"w\" for ASN.1 or SNMP, and \"N\" for Sun XDR.\n\nFor \"pack\", sequence-item may have a repeat count, in which case the minimum of that\nand the number of available items is used as the argument for length-item.  If it has\nno repeat count or uses a '*', the number of available items is used.\n\nFor \"unpack\", an internal stack of integer arguments unpacked so far is used.  You\nwrite \"/\"sequence-item and the repeat count is obtained by popping off the last\nelement from the stack.  The sequence-item must not have a repeat count.\n\nIf sequence-item refers to a string type (\"A\", \"a\", or \"Z\"), the length-item is the\nstring length, not the number of strings.  With an explicit repeat count for pack,\nthe packed string is adjusted to that length.  For example:\n\nThis code:                             gives this result:\n\nunpack(\"W/a\", \"\\004Gurusamy\")          (\"Guru\")\nunpack(\"a3/A A*\", \"007 Bond  J \")      (\" Bond\", \"J\")\nunpack(\"a3 x2 /A A*\", \"007: Bond, J.\") (\"Bond, J\", \".\")\n\npack(\"n/a* w/a\",\"hello,\",\"world\")     \"\\000\\006hello,\\005world\"\npack(\"a/W2\", ord(\"a\") .. ord(\"z\"))    \"2ab\"\n\nThe length-item is not returned explicitly from \"unpack\".\n\nSupplying a count to the length-item format letter is only useful with \"A\", \"a\", or\n\"Z\".  Packing with a length-item of \"a\" or \"Z\" may introduce \"\\000\" characters, which\nPerl does not regard as legal in numeric strings.\n\n•   The integer types \"s\", \"S\", \"l\", and \"L\" may be followed by a \"!\" modifier to specify\nnative shorts or longs.  As shown in the example above, a bare \"l\" means exactly 32\nbits, although the native \"long\" as seen by the local C compiler may be larger.  This\nis mainly an issue on 64-bit platforms.  You can see whether using \"!\" makes any\ndifference this way:\n\nprintf \"format s is %d, s! is %d\\n\",\nlength pack(\"s\"), length pack(\"s!\");\n\nprintf \"format l is %d, l! is %d\\n\",\nlength pack(\"l\"), length pack(\"l!\");\n\n\"i!\" and \"I!\" are also allowed, but only for completeness' sake: they are identical\nto \"i\" and \"I\".\n\nThe actual sizes (in bytes) of native shorts, ints, longs, and long longs on the\nplatform where Perl was built are also available from the command line:\n\n$ perl -V:{short,int,long{,long}}size\nshortsize='2';\nintsize='4';\nlongsize='4';\nlonglongsize='8';\n\nor programmatically via the \"Config\" module:\n\nuse Config;\nprint $Config{shortsize},    \"\\n\";\nprint $Config{intsize},      \"\\n\";\nprint $Config{longsize},     \"\\n\";\nprint $Config{longlongsize}, \"\\n\";\n\n$Config{longlongsize} is undefined on systems without long long support.\n\n•   The integer formats \"s\", \"S\", \"i\", \"I\", \"l\", \"L\", \"j\", and \"J\" are inherently non-\nportable between processors and operating systems because they obey native byteorder\nand endianness.  For example, a 4-byte integer 0x12345678 (305419896 decimal) would\nbe ordered natively (arranged in and handled by the CPU registers) into bytes as\n\n0x12 0x34 0x56 0x78  # big-endian\n0x78 0x56 0x34 0x12  # little-endian\n\nBasically, Intel and VAX CPUs are little-endian, while everybody else, including\nMotorola m68k/88k, PPC, Sparc, HP PA, Power, and Cray, are big-endian.  Alpha and\nMIPS can be either: Digital/Compaq uses (well, used) them in little-endian mode, but\nSGI/Cray uses them in big-endian mode.\n\nThe names big-endian and little-endian are comic references to the egg-eating habits\nof the little-endian Lilliputians and the big-endian Blefuscudians from the classic\nJonathan Swift satire, Gulliver's Travels.  This entered computer lingo via the paper\n\"On Holy Wars and a Plea for Peace\" by Danny Cohen, USC/ISI IEN 137, April 1, 1980.\n\nSome systems may have even weirder byte orders such as\n\n0x56 0x78 0x12 0x34\n0x34 0x12 0x78 0x56\n\nThese are called mid-endian, middle-endian, mixed-endian, or just weird.\n\nYou can determine your system endianness with this incantation:\n\nprintf(\"%#02x \", $) for unpack(\"W*\", pack L=>0x12345678);\n\nThe byteorder on the platform where Perl was built is also available via Config:\n\nuse Config;\nprint \"$Config{byteorder}\\n\";\n\nor from the command line:\n\n$ perl -V:byteorder\n\nByteorders \"1234\" and \"12345678\" are little-endian; \"4321\" and \"87654321\" are big-\nendian.  Systems with multiarchitecture binaries will have \"ffff\", signifying that\nstatic information doesn't work, one must use runtime probing.\n\nFor portably packed integers, either use the formats \"n\", \"N\", \"v\", and \"V\" or else\nuse the \">\" and \"<\" modifiers described immediately below.  See also perlport.\n\n•   Also floating point numbers have endianness.  Usually (but not always) this agrees\nwith the integer endianness.  Even though most platforms these days use the IEEE 754\nbinary format, there are differences, especially if the long doubles are involved.\nYou can see the \"Config\" variables \"doublekind\" and \"longdblkind\" (also \"doublesize\",\n\"longdblsize\"): the \"kind\" values are enums, unlike \"byteorder\".\n\nPortability-wise the best option is probably to keep to the IEEE 754 64-bit doubles,\nand of agreed-upon endianness.  Another possibility is the \"%a\") format of \"printf\".\n\n•   Starting with Perl 5.10.0, integer and floating-point formats, along with the \"p\" and\n\"P\" formats and \"()\" groups, may all be followed by the \">\" or \"<\" endianness\nmodifiers to respectively enforce big- or little-endian byte-order.  These modifiers\nare especially useful given how \"n\", \"N\", \"v\", and \"V\" don't cover signed integers,\n64-bit integers, or floating-point values.\n\nHere are some concerns to keep in mind when using an endianness modifier:\n\n•   Exchanging signed integers between different platforms works only when all\nplatforms store them in the same format.  Most platforms store signed integers in\ntwo's-complement notation, so usually this is not an issue.\n\n•   The \">\" or \"<\" modifiers can only be used on floating-point formats on big- or\nlittle-endian machines.  Otherwise, attempting to use them raises an exception.\n\n•   Forcing big- or little-endian byte-order on floating-point values for data\nexchange can work only if all platforms use the same binary representation such\nas IEEE floating-point.  Even if all platforms are using IEEE, there may still be\nsubtle differences.  Being able to use \">\" or \"<\" on floating-point values can be\nuseful, but also dangerous if you don't know exactly what you're doing.  It is\nnot a general way to portably store floating-point values.\n\n•   When using \">\" or \"<\" on a \"()\" group, this affects all types inside the group\nthat accept byte-order modifiers, including all subgroups.  It is silently\nignored for all other types.  You are not allowed to override the byte-order\nwithin a group that already has a byte-order modifier suffix.\n\n•   Real numbers (floats and doubles) are in native machine format only.  Due to the\nmultiplicity of floating-point formats and the lack of a standard \"network\"\nrepresentation for them, no facility for interchange has been made.  This means that\npacked floating-point data written on one machine may not be readable on another,\neven if both use IEEE floating-point arithmetic (because the endianness of the memory\nrepresentation is not part of the IEEE spec).  See also perlport.\n\nIf you know exactly what you're doing, you can use the \">\" or \"<\" modifiers to force\nbig- or little-endian byte-order on floating-point values.\n\nBecause Perl uses doubles (or long doubles, if configured) internally for all numeric\ncalculation, converting from double into float and thence to double again loses\nprecision, so \"unpack(\"f\", pack(\"f\", $foo)\") will not in general equal $foo.\n\n•   Pack and unpack can operate in two modes: character mode (\"C0\" mode) where the packed\nstring is processed per character, and UTF-8 byte mode (\"U0\" mode) where the packed\nstring is processed in its UTF-8-encoded Unicode form on a byte-by-byte basis.\nCharacter mode is the default unless the format string starts with \"U\".  You can\nalways switch mode mid-format with an explicit \"C0\" or \"U0\" in the format.  This mode\nremains in effect until the next mode change, or until the end of the \"()\" group it\n(directly) applies to.\n\nUsing \"C0\" to get Unicode characters while using \"U0\" to get non-Unicode bytes is not\nnecessarily obvious.   Probably only the first of these is what you want:\n\n$ perl -CS -E 'say \"\\x{3B1}\\x{3C9}\"' |\nperl -CS -ne 'printf \"%v04X\\n\", $ for unpack(\"C0A*\", $)'\n03B1.03C9\n$ perl -CS -E 'say \"\\x{3B1}\\x{3C9}\"' |\nperl -CS -ne 'printf \"%v02X\\n\", $ for unpack(\"U0A*\", $)'\nCE.B1.CF.89\n$ perl -CS -E 'say \"\\x{3B1}\\x{3C9}\"' |\nperl -C0 -ne 'printf \"%v02X\\n\", $ for unpack(\"C0A*\", $)'\nCE.B1.CF.89\n$ perl -CS -E 'say \"\\x{3B1}\\x{3C9}\"' |\nperl -C0 -ne 'printf \"%v02X\\n\", $ for unpack(\"U0A*\", $)'\nC3.8E.C2.B1.C3.8F.C2.89\n\nThose examples also illustrate that you should not try to use \"pack\"/\"unpack\" as a\nsubstitute for the Encode module.\n\n•   You must yourself do any alignment or padding by inserting, for example, enough \"x\"es\nwhile packing.  There is no way for \"pack\" and \"unpack\" to know where characters are\ngoing to or coming from, so they handle their output and input as flat sequences of\ncharacters.\n\n•   A \"()\" group is a sub-TEMPLATE enclosed in parentheses.  A group may take a repeat\ncount either as postfix, or for \"unpack\", also via the \"/\" template character.\nWithin each repetition of a group, positioning with \"@\" starts over at 0.  Therefore,\nthe result of\n\npack(\"@1A((@2A)@3A)\", qw[X Y Z])\n\nis the string \"\\0X\\0\\0YZ\".\n\n•   \"x\" and \"X\" accept the \"!\" modifier to act as alignment commands: they jump forward\nor back to the closest position aligned at a multiple of \"count\" characters.  For\nexample, to \"pack\" or \"unpack\" a C structure like\n\nstruct {\nchar   c;    /* one signed, 8-bit character */\ndouble d;\nchar   cc[2];\n}\n\none may need to use the template \"c x![d] d c[2]\".  This assumes that doubles must be\naligned to the size of double.\n\nFor alignment commands, a \"count\" of 0 is equivalent to a \"count\" of 1; both are no-\nops.\n\n•   \"n\", \"N\", \"v\" and \"V\" accept the \"!\" modifier to represent signed 16-/32-bit integers\nin big-/little-endian order.  This is portable only when all platforms sharing packed\ndata use the same binary representation for signed integers; for example, when all\nplatforms use two's-complement representation.\n\n•   Comments can be embedded in a TEMPLATE using \"#\" through the end of line.  White\nspace can separate pack codes from each other, but modifiers and repeat counts must\nfollow immediately.  Breaking complex templates into individual line-by-line\ncomponents, suitably annotated, can do as much to improve legibility and\nmaintainability of pack/unpack formats as \"/x\" can for complicated pattern matches.\n\n•   If TEMPLATE requires more arguments than \"pack\" is given, \"pack\" assumes additional\n\"\" arguments.  If TEMPLATE requires fewer arguments than given, extra arguments are\nignored.\n\n•   Attempting to pack the special floating point values \"Inf\" and \"NaN\" (infinity, also\nin negative, and not-a-number) into packed integer values (like \"L\") is a fatal\nerror.  The reason for this is that there simply isn't any sensible mapping for these\nspecial values into integers.\n\nExamples:\n\n$foo = pack(\"WWWW\",65,66,67,68);\n# foo eq \"ABCD\"\n$foo = pack(\"W4\",65,66,67,68);\n# same thing\n$foo = pack(\"W4\",0x24b6,0x24b7,0x24b8,0x24b9);\n# same thing with Unicode circled letters.\n$foo = pack(\"U4\",0x24b6,0x24b7,0x24b8,0x24b9);\n# same thing with Unicode circled letters.  You don't get the\n# UTF-8 bytes because the U at the start of the format caused\n# a switch to U0-mode, so the UTF-8 bytes get joined into\n# characters\n$foo = pack(\"C0U4\",0x24b6,0x24b7,0x24b8,0x24b9);\n# foo eq \"\\xe2\\x92\\xb6\\xe2\\x92\\xb7\\xe2\\x92\\xb8\\xe2\\x92\\xb9\"\n# This is the UTF-8 encoding of the string in the\n# previous example\n\n$foo = pack(\"ccxxcc\",65,66,67,68);\n# foo eq \"AB\\0\\0CD\"\n\n# NOTE: The examples above featuring \"W\" and \"c\" are true\n# only on ASCII and ASCII-derived systems such as ISO Latin 1\n# and UTF-8.  On EBCDIC systems, the first example would be\n#      $foo = pack(\"WWWW\",193,194,195,196);\n\n$foo = pack(\"s2\",1,2);\n# \"\\001\\000\\002\\000\" on little-endian\n# \"\\000\\001\\000\\002\" on big-endian\n\n$foo = pack(\"a4\",\"abcd\",\"x\",\"y\",\"z\");\n# \"abcd\"\n\n$foo = pack(\"aaaa\",\"abcd\",\"x\",\"y\",\"z\");\n# \"axyz\"\n\n$foo = pack(\"a14\",\"abcdefg\");\n# \"abcdefg\\0\\0\\0\\0\\0\\0\\0\"\n\n$foo = pack(\"i9pl\", gmtime);\n# a real struct tm (on my system anyway)\n\n$utmptemplate = \"Z8 Z8 Z16 L\";\n$utmp = pack($utmptemplate, @utmp1);\n# a struct utmp (BSDish)\n\n@utmp2 = unpack($utmptemplate, $utmp);\n# \"@utmp1\" eq \"@utmp2\"\n\nsub bintodec {\nunpack(\"N\", pack(\"B32\", substr(\"0\" x 32 . shift, -32)));\n}\n\n$foo = pack('sx2l', 12, 34);\n# short 12, two zero bytes padding, long 34\n$bar = pack('s@4l', 12, 34);\n# short 12, zero fill to position 4, long 34\n# $foo eq $bar\n$baz = pack('s.l', 12, 4, 34);\n# short 12, zero fill to position 4, long 34\n\n$foo = pack('nN', 42, 4711);\n# pack big-endian 16- and 32-bit unsigned integers\n$foo = pack('S>L>', 42, 4711);\n# exactly the same\n$foo = pack('s<l<', -42, 4711);\n# pack little-endian 16- and 32-bit signed integers\n$foo = pack('(sl)<', -42, 4711);\n# exactly the same\n\nThe same template may generally also be used in \"unpack\".\n\npackage NAMESPACE\npackage NAMESPACE VERSION\npackage NAMESPACE BLOCK\npackage NAMESPACE VERSION BLOCK\nDeclares the BLOCK or the rest of the compilation unit as being in the given namespace.\nThe scope of the package declaration is either the supplied code BLOCK or, in the absence\nof a BLOCK, from the declaration itself through the end of current scope (the enclosing\nblock, file, or \"eval\").  That is, the forms without a BLOCK are operative through the\nend of the current scope, just like the \"my\", \"state\", and \"our\" operators.  All\nunqualified dynamic identifiers in this scope will be in the given namespace, except\nwhere overridden by another \"package\" declaration or when they're one of the special\nidentifiers that qualify into \"main::\", like \"STDOUT\", \"ARGV\", \"ENV\", and the punctuation\nvariables.\n\nA package statement affects dynamic variables only, including those you've used \"local\"\non, but not lexically-scoped variables, which are created with \"my\", \"state\", or \"our\".\nTypically it would be the first declaration in a file included by \"require\" or \"use\".\nYou can switch into a package in more than one place, since this only determines which\ndefault symbol table the compiler uses for the rest of that block.  You can refer to\nidentifiers in other packages than the current one by prefixing the identifier with the\npackage name and a double colon, as in $SomePack::var or \"ThatPack::INPUTHANDLE\".  If\npackage name is omitted, the \"main\" package is assumed.  That is, $::sail is equivalent\nto $main::sail (as well as to \"$main'sail\", still seen in ancient code, mostly from Perl\n4).\n\nIf VERSION is provided, \"package\" sets the $VERSION variable in the given namespace to a\nversion object with the VERSION provided.  VERSION must be a \"strict\" style version\nnumber as defined by the version module: a positive decimal number (integer or decimal-\nfraction) without exponentiation or else a dotted-decimal v-string with a leading 'v'\ncharacter and at least three components.  You should set $VERSION only once per package.\n\nSee \"Packages\" in perlmod for more information about packages, modules, and classes.  See\nperlsub for other scoping issues.\n\nPACKAGE\nA special token that returns the name of the package in which it occurs.\n\npipe READHANDLE,WRITEHANDLE\nOpens a pair of connected pipes like the corresponding system call.  Note that if you set\nup a loop of piped processes, deadlock can occur unless you are very careful.  In\naddition, note that Perl's pipes use IO buffering, so you may need to set $| to flush\nyour WRITEHANDLE after each command, depending on the application.\n\nReturns true on success.\n\nSee IPC::Open2, IPC::Open3, and \"Bidirectional Communication with Another Process\" in\nperlipc for examples of such things.\n\nOn systems that support a close-on-exec flag on files, that flag is set on all newly\nopened file descriptors whose \"fileno\"s are higher than the current value of $^F (by\ndefault 2 for \"STDERR\").  See \"$^F\" in perlvar.\n\npop ARRAY\npop Pops and returns the last value of the array, shortening the array by one element.\n\nReturns the undefined value if the array is empty, although this may also happen at other\ntimes.  If ARRAY is omitted, pops the @ARGV array in the main program, but the @ array\nin subroutines, just like \"shift\".\n\nStarting with Perl 5.14, an experimental feature allowed \"pop\" to take a scalar\nexpression. This experiment has been deemed unsuccessful, and was removed as of Perl\n5.24.\n\npos SCALAR\npos Returns the offset of where the last \"m//g\" search left off for the variable in question\n($ is used when the variable is not specified).  This offset is in characters unless the\n(no-longer-recommended) \"use bytes\" pragma is in effect, in which case the offset is in\nbytes.  Note that 0 is a valid match offset.  \"undef\" indicates that the search position\nis reset (usually due to match failure, but can also be because no match has yet been run\non the scalar).\n\n\"pos\" directly accesses the location used by the regexp engine to store the offset, so\nassigning to \"pos\" will change that offset, and so will also influence the \"\\G\" zero-\nwidth assertion in regular expressions.  Both of these effects take place for the next\nmatch, so you can't affect the position with \"pos\" during the current match, such as in\n\"(?{pos() = 5})\" or \"s//pos() = 5/e\".\n\nSetting \"pos\" also resets the matched with zero-length flag, described under \"Repeated\nPatterns Matching a Zero-length Substring\" in perlre.\n\nBecause a failed \"m//gc\" match doesn't reset the offset, the return from \"pos\" won't\nchange either in this case.  See perlre and perlop.\n\nprint FILEHANDLE LIST\nprint FILEHANDLE\nprint LIST\nprint\nPrints a string or a list of strings.  Returns true if successful.  FILEHANDLE may be a\nscalar variable containing the name of or a reference to the filehandle, thus introducing\none level of indirection.  (NOTE: If FILEHANDLE is a variable and the next token is a\nterm, it may be misinterpreted as an operator unless you interpose a \"+\" or put\nparentheses around the arguments.)  If FILEHANDLE is omitted, prints to the last selected\n(see \"select\") output handle.  If LIST is omitted, prints $ to the currently selected\noutput handle.  To use FILEHANDLE alone to print the content of $ to it, you must use a\nbareword filehandle like \"FH\", not an indirect one like $fh.  To set the default output\nhandle to something other than STDOUT, use the select operation.\n\nThe current value of $, (if any) is printed between each LIST item.  The current value of\n\"$\\\" (if any) is printed after the entire LIST has been printed.  Because print takes a\nLIST, anything in the LIST is evaluated in list context, including any subroutines whose\nreturn lists you pass to \"print\".  Be careful not to follow the print keyword with a left\nparenthesis unless you want the corresponding right parenthesis to terminate the\narguments to the print; put parentheses around all arguments (or interpose a \"+\", but\nthat doesn't look as good).\n\nIf you're storing handles in an array or hash, or in general whenever you're using any\nexpression more complex than a bareword handle or a plain, unsubscripted scalar variable\nto retrieve it, you will have to use a block returning the filehandle value instead, in\nwhich case the LIST may not be omitted:\n\nprint { $files[$i] } \"stuff\\n\";\nprint { $OK ? *STDOUT : *STDERR } \"stuff\\n\";\n\nPrinting to a closed pipe or socket will generate a SIGPIPE signal.  See perlipc for more\non signal handling.\n\nprintf FILEHANDLE FORMAT, LIST\nprintf FILEHANDLE\nprintf FORMAT, LIST\nprintf\nEquivalent to \"print FILEHANDLE sprintf(FORMAT, LIST)\", except that \"$\\\" (the output\nrecord separator) is not appended.  The FORMAT and the LIST are actually parsed as a\nsingle list.  The first argument of the list will be interpreted as the \"printf\" format.\nThis means that \"printf(@)\" will use $[0] as the format.  See sprintf for an\nexplanation of the format argument.  If \"use locale\" (including \"use locale\n':notcharacters'\") is in effect and \"POSIX::setlocale\" has been called, the character\nused for the decimal separator in formatted floating-point numbers is affected by the\n\"LCNUMERIC\" locale setting.  See perllocale and POSIX.\n\nFor historical reasons, if you omit the list, $ is used as the format; to use FILEHANDLE\nwithout a list, you must use a bareword filehandle like \"FH\", not an indirect one like\n$fh.  However, this will rarely do what you want; if $ contains formatting codes, they\nwill be replaced with the empty string and a warning will be emitted if warnings are\nenabled.  Just use \"print\" if you want to print the contents of $.\n\nDon't fall into the trap of using a \"printf\" when a simple \"print\" would do.  The \"print\"\nis more efficient and less error prone.\n\nprototype FUNCTION\nprototype\nReturns the prototype of a function as a string (or \"undef\" if the function has no\nprototype).  FUNCTION is a reference to, or the name of, the function whose prototype you\nwant to retrieve.  If FUNCTION is omitted, $ is used.\n\nIf FUNCTION is a string starting with \"CORE::\", the rest is taken as a name for a Perl\nbuiltin.  If the builtin's arguments cannot be adequately expressed by a prototype (such\nas \"system\"), \"prototype\" returns \"undef\", because the builtin does not really behave\nlike a Perl function.  Otherwise, the string describing the equivalent prototype is\nreturned.\n\npush ARRAY,LIST\nTreats ARRAY as a stack by appending the values of LIST to the end of ARRAY.  The length\nof ARRAY increases by the length of LIST.  Has the same effect as\n\nfor my $value (LIST) {\n$ARRAY[++$#ARRAY] = $value;\n}\n\nbut is more efficient.  Returns the number of elements in the array following the\ncompleted \"push\".\n\nStarting with Perl 5.14, an experimental feature allowed \"push\" to take a scalar\nexpression. This experiment has been deemed unsuccessful, and was removed as of Perl\n5.24.\n\nq/STRING/\nqq/STRING/\nqw/STRING/\nqx/STRING/\nGeneralized quotes.  See \"Quote-Like Operators\" in perlop.\n\nqr/STRING/\nRegexp-like quote.  See \"Regexp Quote-Like Operators\" in perlop.\n\nquotemeta EXPR\nquotemeta\nReturns the value of EXPR with all the ASCII non-\"word\" characters backslashed.  (That\nis, all ASCII characters not matching \"/[A-Za-z0-9]/\" will be preceded by a backslash in\nthe returned string, regardless of any locale settings.)  This is the internal function\nimplementing the \"\\Q\" escape in double-quoted strings.  (See below for the behavior on\nnon-ASCII code points.)\n\nIf EXPR is omitted, uses $.\n\nquotemeta (and \"\\Q\" ... \"\\E\") are useful when interpolating strings into regular\nexpressions, because by default an interpolated variable will be considered a mini-\nregular expression.  For example:\n\nmy $sentence = 'The quick brown fox jumped over the lazy dog';\nmy $substring = 'quick.*?fox';\n$sentence =~ s{$substring}{big bad wolf};\n\nWill cause $sentence to become 'The big bad wolf jumped over...'.\n\nOn the other hand:\n\nmy $sentence = 'The quick brown fox jumped over the lazy dog';\nmy $substring = 'quick.*?fox';\n$sentence =~ s{\\Q$substring\\E}{big bad wolf};\n\nOr:\n\nmy $sentence = 'The quick brown fox jumped over the lazy dog';\nmy $substring = 'quick.*?fox';\nmy $quotedsubstring = quotemeta($substring);\n$sentence =~ s{$quotedsubstring}{big bad wolf};\n\nWill both leave the sentence as is.  Normally, when accepting literal string input from\nthe user, \"quotemeta\" or \"\\Q\" must be used.\n\nBeware that if you put literal backslashes (those not inside interpolated variables)\nbetween \"\\Q\" and \"\\E\", double-quotish backslash interpolation may lead to confusing\nresults.  If you need to use literal backslashes within \"\\Q...\\E\", consult \"Gory details\nof parsing quoted constructs\" in perlop.\n\nBecause the result of \"\\Q STRING \\E\" has all metacharacters quoted, there is no way to\ninsert a literal \"$\" or \"@\" inside a \"\\Q\\E\" pair.  If protected by \"\\\", \"$\" will be\nquoted to become \"\\\\\\$\"; if not, it is interpreted as the start of an interpolated\nscalar.\n\nIn Perl v5.14, all non-ASCII characters are quoted in non-UTF-8-encoded strings, but not\nquoted in UTF-8 strings.\n\nStarting in Perl v5.16, Perl adopted a Unicode-defined strategy for quoting non-ASCII\ncharacters; the quoting of ASCII characters is unchanged.\n\nAlso unchanged is the quoting of non-UTF-8 strings when outside the scope of a \"use\nfeature 'unicodestrings'\", which is to quote all characters in the upper Latin1 range.\nThis provides complete backwards compatibility for old programs which do not use Unicode.\n(Note that \"unicodestrings\" is automatically enabled within the scope of a \"use v5.12\"\nor greater.)\n\nWithin the scope of \"use locale\", all non-ASCII Latin1 code points are quoted whether the\nstring is encoded as UTF-8 or not.  As mentioned above, locale does not affect the\nquoting of ASCII-range characters.  This protects against those locales where characters\nsuch as \"|\" are considered to be word characters.\n\nOtherwise, Perl quotes non-ASCII characters using an adaptation from Unicode (see\n<https://www.unicode.org/reports/tr31/>).  The only code points that are quoted are those\nthat have any of the Unicode properties:  PatternSyntax, PatternWhiteSpace,\nWhiteSpace, DefaultIgnorableCodePoint, or GeneralCategory=Control.\n\nOf these properties, the two important ones are PatternSyntax and PatternWhiteSpace.\nThey have been set up by Unicode for exactly this purpose of deciding which characters in\na regular expression pattern should be quoted.  No character that can be in an identifier\nhas these properties.\n\nPerl promises, that if we ever add regular expression pattern metacharacters to the dozen\nalready defined (\"\\ | ( ) [ { ^ $ * + ? .\"), that we will only use ones that have the\nPatternSyntax property.  Perl also promises, that if we ever add characters that are\nconsidered to be white space in regular expressions (currently mostly affected by \"/x\"),\nthey will all have the PatternWhiteSpace property.\n\nUnicode promises that the set of code points that have these two properties will never\nchange, so something that is not quoted in v5.16 will never need to be quoted in any\nfuture Perl release.  (Not all the code points that match PatternSyntax have actually\nhad characters assigned to them; so there is room to grow, but they are quoted whether\nassigned or not.  Perl, of course, would never use an unassigned code point as an actual\nmetacharacter.)\n\nQuoting characters that have the other 3 properties is done to enhance the readability of\nthe regular expression and not because they actually need to be quoted for regular\nexpression purposes (characters with the WhiteSpace property are likely to be\nindistinguishable on the page or screen from those with the PatternWhiteSpace property;\nand the other two properties contain non-printing characters).\n\nrand EXPR\nrand\nReturns a random fractional number greater than or equal to 0 and less than the value of\nEXPR.  (EXPR should be positive.)  If EXPR is omitted, the value 1 is used.  Currently\nEXPR with the value 0 is also special-cased as 1 (this was undocumented before Perl 5.8.0\nand is subject to change in future versions of Perl).  Automatically calls \"srand\" unless\n\"srand\" has already been called.  See also \"srand\".\n\nApply \"int\" to the value returned by \"rand\" if you want random integers instead of random\nfractional numbers.  For example,\n\nint(rand(10))\n\nreturns a random integer between 0 and 9, inclusive.\n\n(Note: If your rand function consistently returns numbers that are too large or too\nsmall, then your version of Perl was probably compiled with the wrong number of\nRANDBITS.)\n\n\"rand\" is not cryptographically secure.  You should not rely on it in security-sensitive\nsituations.  As of this writing, a number of third-party CPAN modules offer random number\ngenerators intended by their authors to be cryptographically secure, including:\nData::Entropy, Crypt::Random, Math::Random::Secure, and Math::TrulyRandom.\n\nread FILEHANDLE,SCALAR,LENGTH,OFFSET\nread FILEHANDLE,SCALAR,LENGTH\nAttempts to read LENGTH characters of data into variable SCALAR from the specified\nFILEHANDLE.  Returns the number of characters actually read, 0 at end of file, or undef\nif there was an error (in the latter case $! is also set).  SCALAR will be grown or\nshrunk so that the last character actually read is the last character of the scalar after\nthe read.\n\nAn OFFSET may be specified to place the read data at some place in the string other than\nthe beginning.  A negative OFFSET specifies placement at that many characters counting\nbackwards from the end of the string.  A positive OFFSET greater than the length of\nSCALAR results in the string being padded to the required size with \"\\0\" bytes before the\nresult of the read is appended.\n\nThe call is implemented in terms of either Perl's or your system's native fread(3)\nlibrary function, via the PerlIO layers applied to the handle.  To get a true read(2)\nsystem call, see sysread.\n\nNote the characters: depending on the status of the filehandle, either (8-bit) bytes or\ncharacters are read.  By default, all filehandles operate on bytes, but for example if\nthe filehandle has been opened with the \":utf8\" I/O layer (see \"open\", and the open\npragma), the I/O will operate on UTF8-encoded Unicode characters, not bytes.  Similarly\nfor the \":encoding\" layer: in that case pretty much any characters can be read.\n\nreaddir DIRHANDLE\nReturns the next directory entry for a directory opened by \"opendir\".  If used in list\ncontext, returns all the rest of the entries in the directory.  If there are no more\nentries, returns the undefined value in scalar context and the empty list in list\ncontext.\n\nIf you're planning to filetest the return values out of a \"readdir\", you'd better prepend\nthe directory in question.  Otherwise, because we didn't \"chdir\" there, it would have\nbeen testing the wrong file.\n\nopendir(my $dh, $somedir) || die \"Can't opendir $somedir: $!\";\nmy @dots = grep { /^\\./ && -f \"$somedir/$\" } readdir($dh);\nclosedir $dh;\n\nAs of Perl 5.12 you can use a bare \"readdir\" in a \"while\" loop, which will set $ on\nevery iteration.  If either a \"readdir\" expression or an explicit assignment of a\n\"readdir\" expression to a scalar is used as a \"while\"/\"for\" condition, then the condition\nactually tests for definedness of the expression's value, not for its regular truth\nvalue.\n\nopendir(my $dh, $somedir) || die \"Can't open $somedir: $!\";\nwhile (readdir $dh) {\nprint \"$somedir/$\\n\";\n}\nclosedir $dh;\n\nTo avoid confusing would-be users of your code who are running earlier versions of Perl\nwith mysterious failures, put this sort of thing at the top of your file to signal that\nyour code will work only on Perls of a recent vintage:\n\nuse 5.012; # so readdir assigns to $ in a lone while test\n\nreadline EXPR\nreadline\nReads from the filehandle whose typeglob is contained in EXPR (or from *ARGV if EXPR is\nnot provided).  In scalar context, each call reads and returns the next line until end-\nof-file is reached, whereupon the subsequent call returns \"undef\".  In list context,\nreads until end-of-file is reached and returns a list of lines.  Note that the notion of\n\"line\" used here is whatever you may have defined with $/ (or $INPUTRECORDSEPARATOR in\nEnglish).  See \"$/\" in perlvar.\n\nWhen $/ is set to \"undef\", when \"readline\" is in scalar context (i.e., file slurp mode),\nand when an empty file is read, it returns '' the first time, followed by \"undef\"\nsubsequently.\n\nThis is the internal function implementing the \"<EXPR>\" operator, but you can use it\ndirectly.  The \"<EXPR>\" operator is discussed in more detail in \"I/O Operators\" in\nperlop.\n\nmy $line = <STDIN>;\nmy $line = readline(STDIN);    # same thing\n\nIf \"readline\" encounters an operating system error, $! will be set with the corresponding\nerror message.  It can be helpful to check $! when you are reading from filehandles you\ndon't trust, such as a tty or a socket.  The following example uses the operator form of\n\"readline\" and dies if the result is not defined.\n\nwhile ( ! eof($fh) ) {\ndefined( $ = readline $fh ) or die \"readline failed: $!\";\n...\n}\n\nNote that you have can't handle \"readline\" errors that way with the \"ARGV\" filehandle.\nIn that case, you have to open each element of @ARGV yourself since \"eof\" handles \"ARGV\"\ndifferently.\n\nforeach my $arg (@ARGV) {\nopen(my $fh, $arg) or warn \"Can't open $arg: $!\";\n\nwhile ( ! eof($fh) ) {\ndefined( $ = readline $fh )\nor die \"readline failed for $arg: $!\";\n...\n}\n}\n\nLike the \"<EXPR>\" operator, if a \"readline\" expression is used as the condition of a\n\"while\" or \"for\" loop, then it will be implicitly assigned to $.  If either a \"readline\"\nexpression or an explicit assignment of a \"readline\" expression to a scalar is used as a\n\"while\"/\"for\" condition, then the condition actually tests for definedness of the\nexpression's value, not for its regular truth value.\n\nreadlink EXPR\nreadlink\nReturns the value of a symbolic link, if symbolic links are implemented.  If not, raises\nan exception.  If there is a system error, returns the undefined value and sets $!\n(errno).  If EXPR is omitted, uses $.\n\nPortability issues: \"readlink\" in perlport.\n\nreadpipe EXPR\nreadpipe\nEXPR is executed as a system command.  The collected standard output of the command is\nreturned.  In scalar context, it comes back as a single (potentially multi-line) string.\nIn list context, returns a list of lines (however you've defined lines with $/ (or\n$INPUTRECORDSEPARATOR in English)).  This is the internal function implementing the\n\"qx/EXPR/\" operator, but you can use it directly.  The \"qx/EXPR/\" operator is discussed\nin more detail in \"\"qx/STRING/\"\" in perlop.  If EXPR is omitted, uses $.\n\nrecv SOCKET,SCALAR,LENGTH,FLAGS\nReceives a message on a socket.  Attempts to receive LENGTH characters of data into\nvariable SCALAR from the specified SOCKET filehandle.  SCALAR will be grown or shrunk to\nthe length actually read.  Takes the same flags as the system call of the same name.\nReturns the address of the sender if SOCKET's protocol supports this; returns an empty\nstring otherwise.  If there's an error, returns the undefined value.  This call is\nactually implemented in terms of the recvfrom(2) system call.  See \"UDP: Message Passing\"\nin perlipc for examples.\n\nNote that if the socket has been marked as \":utf8\", \"recv\" will throw an exception.  The\n\":encoding(...)\" layer implicitly introduces the \":utf8\" layer.  See \"binmode\".\n\nredo LABEL\nredo EXPR\nredo\nThe \"redo\" command restarts the loop block without evaluating the conditional again.  The\n\"continue\" block, if any, is not executed.  If the LABEL is omitted, the command refers\nto the innermost enclosing loop.  The \"redo EXPR\" form, available starting in Perl\n5.18.0, allows a label name to be computed at run time, and is otherwise identical to\n\"redo LABEL\".  Programs that want to lie to themselves about what was just input normally\nuse this command:\n\n# a simpleminded Pascal comment stripper\n# (warning: assumes no { or } in strings)\nLINE: while (<STDIN>) {\nwhile (s|({.*}.*){.*}|$1 |) {}\ns|{.*}| |;\nif (s|{.*| |) {\nmy $front = $;\nwhile (<STDIN>) {\nif (/}/) {  # end of comment?\ns|^|$front\\{|;\nredo LINE;\n}\n}\n}\nprint;\n}\n\n\"redo\" cannot return a value from a block that typically returns a value, such as \"eval\n{}\", \"sub {}\", or \"do {}\". It will perform its flow control behavior, which precludes any\nreturn value. It should not be used to exit a \"grep\" or \"map\" operation.\n\nNote that a block by itself is semantically identical to a loop that executes once.  Thus\n\"redo\" inside such a block will effectively turn it into a looping construct.\n\nSee also \"continue\" for an illustration of how \"last\", \"next\", and \"redo\" work.\n\nUnlike most named operators, this has the same precedence as assignment.  It is also\nexempt from the looks-like-a-function rule, so \"redo (\"foo\").\"bar\"\" will cause \"bar\" to\nbe part of the argument to \"redo\".\n\nref EXPR\nref Examines the value of EXPR, expecting it to be a reference, and returns a string giving\ninformation about the reference and the type of referent.  If EXPR is not specified, $\nwill be used.\n\nIf the operand is not a reference, then the empty string will be returned.  An empty\nstring will only be returned in this situation.  \"ref\" is often useful to just test\nwhether a value is a reference, which can be done by comparing the result to the empty\nstring.  It is a common mistake to use the result of \"ref\" directly as a truth value:\nthis goes wrong because 0 (which is false) can be returned for a reference.\n\nIf the operand is a reference to a blessed object, then the name of the class into which\nthe referent is blessed will be returned.  \"ref\" doesn't care what the physical type of\nthe referent is; blessing takes precedence over such concerns.  Beware that exact\ncomparison of \"ref\" results against a class name doesn't perform a class membership test:\na class's members also include objects blessed into subclasses, for which \"ref\" will\nreturn the name of the subclass.  Also beware that class names can clash with the built-\nin type names (described below).\n\nIf the operand is a reference to an unblessed object, then the return value indicates the\ntype of object.  If the unblessed referent is not a scalar, then the return value will be\none of the strings \"ARRAY\", \"HASH\", \"CODE\", \"FORMAT\", or \"IO\", indicating only which kind\nof object it is.  If the unblessed referent is a scalar, then the return value will be\none of the strings \"SCALAR\", \"VSTRING\", \"REF\", \"GLOB\", \"LVALUE\", or \"REGEXP\", depending\non the kind of value the scalar currently has.   But note that \"qr//\" scalars are created\nalready blessed, so \"ref qr/.../\" will likely return \"Regexp\".  Beware that these built-\nin type names can also be used as class names, so \"ref\" returning one of these names\ndoesn't unambiguously indicate that the referent is of the kind to which the name refers.\n\nThe ambiguity between built-in type names and class names significantly limits the\nutility of \"ref\".  For unambiguous information, use \"Scalar::Util::blessed()\" for\ninformation about blessing, and \"Scalar::Util::reftype()\" for information about physical\ntypes.  Use the \"isa\" method for class membership tests, though one must be sure of\nblessedness before attempting a method call.\n\nSee also perlref and perlobj.\n\nrename OLDNAME,NEWNAME\nChanges the name of a file; an existing file NEWNAME will be clobbered.  Returns true for\nsuccess; on failure returns false and sets $!.\n\nBehavior of this function varies wildly depending on your system implementation.  For\nexample, it will usually not work across file system boundaries, even though the system\nmv command sometimes compensates for this.  Other restrictions include whether it works\non directories, open files, or pre-existing files.  Check perlport and either the\nrename(2) manpage or equivalent system documentation for details.\n\nFor a platform independent \"move\" function look at the File::Copy module.\n\nPortability issues: \"rename\" in perlport.\n\nrequire VERSION\nrequire EXPR\nrequire\nDemands a version of Perl specified by VERSION, or demands some semantics specified by\nEXPR or by $ if EXPR is not supplied.\n\nVERSION may be either a literal such as v5.24.1, which will be compared to $^V (or\n$PERLVERSION in English), or a numeric argument of the form 5.024001, which will be\ncompared to $]. An exception is raised if VERSION is greater than the version of the\ncurrent Perl interpreter.  Compare with \"use\", which can do a similar check at compile\ntime.\n\nSpecifying VERSION as a numeric argument of the form 5.024001 should generally be avoided\nas older less readable syntax compared to v5.24.1. Before perl 5.8.0 (released in 2002),\nthe more verbose numeric form was the only supported syntax, which is why you might see\nit in older code.\n\nrequire v5.24.1;    # run time version check\nrequire 5.24.1;     # ditto\nrequire 5.024001;  # ditto; older syntax compatible\nwith perl 5.6\n\nOtherwise, \"require\" demands that a library file be included if it hasn't already been\nincluded.  The file is included via the do-FILE mechanism, which is essentially just a\nvariety of \"eval\" with the caveat that lexical variables in the invoking script will be\ninvisible to the included code.  If it were implemented in pure Perl, it would have\nsemantics similar to the following:\n\nuse Carp 'croak';\nuse version;\n\nsub require {\nmy ($filename) = @;\nif ( my $version = eval { version->parse($filename) } ) {\nif ( $version > $^V ) {\nmy $vn = $version->normal;\ncroak \"Perl $vn required--this is only $^V, stopped\";\n}\nreturn 1;\n}\n\nif (exists $INC{$filename}) {\nreturn 1 if $INC{$filename};\ncroak \"Compilation failed in require\";\n}\n\nforeach $prefix (@INC) {\nif (ref($prefix)) {\n#... do other stuff - see text below ....\n}\n# (see text below about possible appending of .pmc\n# suffix to $filename)\nmy $realfilename = \"$prefix/$filename\";\nnext if ! -e $realfilename || -d  || -b ;\n$INC{$filename} = $realfilename;\nmy $result = do($realfilename);\n# but run in caller's namespace\n\nif (!defined $result) {\n$INC{$filename} = undef;\ncroak $@ ? \"$@Compilation failed in require\"\n: \"Can't locate $filename: $!\\n\";\n}\nif (!$result) {\ndelete $INC{$filename};\ncroak \"$filename did not return true value\";\n}\n$! = 0;\nreturn $result;\n}\ncroak \"Can't locate $filename in \\@INC ...\";\n}\n\nNote that the file will not be included twice under the same specified name.\n\nThe file must return true as the last statement to indicate successful execution of any\ninitialization code, so it's customary to end such a file with \"1;\" unless you're sure\nit'll return true otherwise.  But it's better just to put the \"1;\", in case you add more\nstatements.\n\nIf EXPR is a bareword, \"require\" assumes a .pm extension and replaces \"::\" with \"/\" in\nthe filename for you, to make it easy to load standard modules.  This form of loading of\nmodules does not risk altering your namespace, however it will autovivify the stash for\nthe required module.\n\nIn other words, if you try this:\n\nrequire Foo::Bar;     # a splendid bareword\n\nThe require function will actually look for the Foo/Bar.pm file in the directories\nspecified in the @INC array, and it will autovivify the \"Foo::Bar::\" stash at compile\ntime.\n\nBut if you try this:\n\nmy $class = 'Foo::Bar';\nrequire $class;       # $class is not a bareword\n#or\nrequire \"Foo::Bar\";   # not a bareword because of the \"\"\n\nThe require function will look for the Foo::Bar file in the @INC  array and will complain\nabout not finding Foo::Bar there.  In this case you can do:\n\neval \"require $class\";\n\nor you could do\n\nrequire \"Foo/Bar.pm\";\n\nNeither of these forms will autovivify any stashes at compile time and only have run time\neffects.\n\nNow that you understand how \"require\" looks for files with a bareword argument, there is\na little extra functionality going on behind the scenes.  Before \"require\" looks for a\n.pm extension, it will first look for a similar filename with a .pmc extension.  If this\nfile is found, it will be loaded in place of any file ending in a .pm extension. This\napplies to both the explicit \"require \"Foo/Bar.pm\";\" form and the \"require Foo::Bar;\"\nform.\n\nYou can also insert hooks into the import facility by putting Perl code directly into the\n@INC array.  There are three forms of hooks: subroutine references, array references, and\nblessed objects.\n\nSubroutine references are the simplest case.  When the inclusion system walks through\n@INC and encounters a subroutine, this subroutine gets called with two parameters, the\nfirst a reference to itself, and the second the name of the file to be included (e.g.,\nFoo/Bar.pm).  The subroutine should return either nothing or else a list of up to four\nvalues in the following order:\n\n1.  A reference to a scalar, containing any initial source code to prepend to the file or\ngenerator output.\n\n2.  A filehandle, from which the file will be read.\n\n3.  A reference to a subroutine.  If there is no filehandle (previous item), then this\nsubroutine is expected to generate one line of source code per call, writing the line\ninto $ and returning 1, then finally at end of file returning 0.  If there is a\nfilehandle, then the subroutine will be called to act as a simple source filter, with\nthe line as read in $.  Again, return 1 for each valid line, and 0 after all lines\nhave been returned.  For historical reasons the subroutine will receive a meaningless\nargument (in fact always the numeric value zero) as $[0].\n\n4.  Optional state for the subroutine.  The state is passed in as $[1].\n\nIf an empty list, \"undef\", or nothing that matches the first 3 values above is returned,\nthen \"require\" looks at the remaining elements of @INC.  Note that this filehandle must\nbe a real filehandle (strictly a typeglob or reference to a typeglob, whether blessed or\nunblessed); tied filehandles will be ignored and processing will stop there.\n\nIf the hook is an array reference, its first element must be a subroutine reference.\nThis subroutine is called as above, but the first parameter is the array reference.  This\nlets you indirectly pass arguments to the subroutine.\n\nIn other words, you can write:\n\npush @INC, \\&mysub;\nsub mysub {\nmy ($coderef, $filename) = @;  # $coderef is \\&mysub\n...\n}\n\nor:\n\npush @INC, [ \\&mysub, $x, $y, ... ];\nsub mysub {\nmy ($arrayref, $filename) = @;\n# Retrieve $x, $y, ...\nmy (undef, @parameters) = @$arrayref;\n...\n}\n\nIf the hook is an object, it must provide an \"INC\" method that will be called as above,\nthe first parameter being the object itself.  (Note that you must fully qualify the sub's\nname, as unqualified \"INC\" is always forced into package \"main\".)  Here is a typical code\nlayout:\n\n# In Foo.pm\npackage Foo;\nsub new { ... }\nsub Foo::INC {\nmy ($self, $filename) = @;\n...\n}\n\n# In the main program\npush @INC, Foo->new(...);\n\nThese hooks are also permitted to set the %INC entry corresponding to the files they have\nloaded.  See \"%INC\" in perlvar.\n\nFor a yet-more-powerful import facility, see \"use\" and perlmod.\n\nreset EXPR\nreset\nGenerally used in a \"continue\" block at the end of a loop to clear variables and reset\n\"m?pattern?\" searches so that they work again.  The expression is interpreted as a list\nof single characters (hyphens allowed for ranges).  All variables (scalars, arrays, and\nhashes) in the current package beginning with one of those letters are reset to their\npristine state.  If the expression is omitted, one-match searches (\"m?pattern?\") are\nreset to match again.  Only resets variables or searches in the current package.  Always\nreturns 1.  Examples:\n\nreset 'X';      # reset all X variables\nreset 'a-z';    # reset lower case variables\nreset;          # just reset m?one-time? searches\n\nResetting \"A-Z\" is not recommended because you'll wipe out your @ARGV and @INC arrays and\nyour %ENV hash.\n\nResets only package variables; lexical variables are unaffected, but they clean\nthemselves up on scope exit anyway, so you'll probably want to use them instead.  See\n\"my\".\n\nreturn EXPR\nreturn\nReturns from a subroutine, \"eval\", \"do FILE\", \"sort\" block or regex eval block (but not a\n\"grep\", \"map\", or \"do BLOCK\" block) with the value given in EXPR.  Evaluation of EXPR may\nbe in list, scalar, or void context, depending on how the return value will be used, and\nthe context may vary from one execution to the next (see \"wantarray\").  If no EXPR is\ngiven, returns an empty list in list context, the undefined value in scalar context, and\n(of course) nothing at all in void context.\n\n(In the absence of an explicit \"return\", a subroutine, \"eval\", or \"do FILE\" automatically\nreturns the value of the last expression evaluated.)\n\nUnlike most named operators, this is also exempt from the looks-like-a-function rule, so\n\"return (\"foo\").\"bar\"\" will cause \"bar\" to be part of the argument to \"return\".\n\nreverse LIST\nIn list context, returns a list value consisting of the elements of LIST in the opposite\norder.  In scalar context, concatenates the elements of LIST and returns a string value\nwith all characters in the opposite order.\n\nprint join(\", \", reverse \"world\", \"Hello\"); # Hello, world\n\nprint scalar reverse \"dlrow ,\", \"olleH\";    # Hello, world\n\nUsed without arguments in scalar context, \"reverse\" reverses $.\n\n$ = \"dlrow ,olleH\";\nprint reverse;                         # No output, list context\nprint scalar reverse;                  # Hello, world\n\nNote that reversing an array to itself (as in \"@a = reverse @a\") will preserve non-\nexistent elements whenever possible; i.e., for non-magical arrays or for tied arrays with\n\"EXISTS\" and \"DELETE\" methods.\n\nThis operator is also handy for inverting a hash, although there are some caveats.  If a\nvalue is duplicated in the original hash, only one of those can be represented as a key\nin the inverted hash.  Also, this has to unwind one hash and build a whole new one, which\nmay take some time on a large hash, such as from a DBM file.\n\nmy %byname = reverse %byaddress;  # Invert the hash\n\nrewinddir DIRHANDLE\nSets the current position to the beginning of the directory for the \"readdir\" routine on\nDIRHANDLE.\n\nPortability issues: \"rewinddir\" in perlport.\n\nrindex STR,SUBSTR,POSITION\nrindex STR,SUBSTR\nWorks just like \"index\" except that it returns the position of the last occurrence of\nSUBSTR in STR.  If POSITION is specified, returns the last occurrence beginning at or\nbefore that position.\n\nrmdir FILENAME\nrmdir\nDeletes the directory specified by FILENAME if that directory is empty.  If it succeeds\nit returns true; otherwise it returns false and sets $! (errno).  If FILENAME is omitted,\nuses $.\n\nTo remove a directory tree recursively (\"rm -rf\" on Unix) look at the \"rmtree\" function\nof the File::Path module.\n\ns///\nThe substitution operator.  See \"Regexp Quote-Like Operators\" in perlop.\n\nsay FILEHANDLE LIST\nsay FILEHANDLE\nsay LIST\nsay Just like \"print\", but implicitly appends a newline at the end of the LIST instead of any\nvalue \"$\\\" might have.  To use FILEHANDLE without a LIST to print the contents of $ to\nit, you must use a bareword filehandle like \"FH\", not an indirect one like $fh.\n\n\"say\" is available only if the \"say\" feature is enabled or if it is prefixed with\n\"CORE::\".  The \"say\" feature is enabled automatically with a \"use v5.10\" (or higher)\ndeclaration in the current scope.\n\nscalar EXPR\nForces EXPR to be interpreted in scalar context and returns the value of EXPR.\n\nmy @counts = ( scalar @a, scalar @b, scalar @c );\n\nThere is no equivalent operator to force an expression to be interpolated in list context\nbecause in practice, this is never needed.  If you really wanted to do so, however, you\ncould use the construction \"@{[ (some expression) ]}\", but usually a simple \"(some\nexpression)\" suffices.\n\nBecause \"scalar\" is a unary operator, if you accidentally use a parenthesized list for\nthe EXPR, this behaves as a scalar comma expression, evaluating all but the last element\nin void context and returning the final element evaluated in scalar context.  This is\nseldom what you want.\n\nThe following single statement:\n\nprint uc(scalar(foo(), $bar)), $baz;\n\nis the moral equivalent of these two:\n\nfoo();\nprint(uc($bar), $baz);\n\nSee perlop for more details on unary operators and the comma operator, and perldata for\ndetails on evaluating a hash in scalar context.\n\nseek FILEHANDLE,POSITION,WHENCE\nSets FILEHANDLE's position, just like the fseek(3) call of C \"stdio\".  FILEHANDLE may be\nan expression whose value gives the name of the filehandle.  The values for WHENCE are 0\nto set the new position in bytes to POSITION; 1 to set it to the current position plus\nPOSITION; and 2 to set it to EOF plus POSITION, typically negative.  For WHENCE you may\nuse the constants \"SEEKSET\", \"SEEKCUR\", and \"SEEKEND\" (start of the file, current\nposition, end of the file) from the Fcntl module.  Returns 1 on success, false otherwise.\n\nNote the emphasis on bytes: even if the filehandle has been set to operate on characters\n(for example using the \":encoding(UTF-8)\" I/O layer), the \"seek\", \"tell\", and \"sysseek\"\nfamily of functions use byte offsets, not character offsets, because seeking to a\ncharacter offset would be very slow in a UTF-8 file.\n\nIf you want to position the file for \"sysread\" or \"syswrite\", don't use \"seek\", because\nbuffering makes its effect on the file's read-write position unpredictable and non-\nportable.  Use \"sysseek\" instead.\n\nDue to the rules and rigors of ANSI C, on some systems you have to do a seek whenever you\nswitch between reading and writing.  Amongst other things, this may have the effect of\ncalling stdio's clearerr(3).  A WHENCE of 1 (\"SEEKCUR\") is useful for not moving the\nfile position:\n\nseek($fh, 0, 1);\n\nThis is also useful for applications emulating \"tail -f\".  Once you hit EOF on your read\nand then sleep for a while, you (probably) have to stick in a dummy \"seek\" to reset\nthings.  The \"seek\" doesn't change the position, but it does clear the end-of-file\ncondition on the handle, so that the next \"readline FILE\" makes Perl try again to read\nsomething.  (We hope.)\n\nIf that doesn't work (some I/O implementations are particularly cantankerous), you might\nneed something like this:\n\nfor (;;) {\nfor ($curpos = tell($fh); $ = readline($fh);\n$curpos = tell($fh)) {\n# search for some stuff and put it into files\n}\nsleep($forawhile);\nseek($fh, $curpos, 0);\n}\n\nseekdir DIRHANDLE,POS\nSets the current position for the \"readdir\" routine on DIRHANDLE.  POS must be a value\nreturned by \"telldir\".  \"seekdir\" also has the same caveats about possible directory\ncompaction as the corresponding system library routine.\n\nselect FILEHANDLE\nselect\nReturns the currently selected filehandle.  If FILEHANDLE is supplied, sets the new\ncurrent default filehandle for output.  This has two effects: first, a \"write\" or a\n\"print\" without a filehandle default to this FILEHANDLE.  Second, references to variables\nrelated to output will refer to this output channel.\n\nFor example, to set the top-of-form format for more than one output channel, you might do\nthe following:\n\nselect(REPORT1);\n$^ = 'report1top';\nselect(REPORT2);\n$^ = 'report2top';\n\nFILEHANDLE may be an expression whose value gives the name of the actual filehandle.\nThus:\n\nmy $oldfh = select(STDERR); $| = 1; select($oldfh);\n\nSome programmers may prefer to think of filehandles as objects with methods, preferring\nto write the last example as:\n\nSTDERR->autoflush(1);\n\n(Prior to Perl version 5.14, you have to \"use IO::Handle;\" explicitly first.)\n\nPortability issues: \"select\" in perlport.\n\nselect RBITS,WBITS,EBITS,TIMEOUT\nThis calls the select(2) syscall with the bit masks specified, which can be constructed\nusing \"fileno\" and \"vec\", along these lines:\n\nmy $rin = my $win = my $ein = '';\nvec($rin, fileno(STDIN),  1) = 1;\nvec($win, fileno(STDOUT), 1) = 1;\n$ein = $rin | $win;\n\nIf you want to select on many filehandles, you may wish to write a subroutine like this:\n\nsub fhbits {\nmy @fhlist = @;\nmy $bits = \"\";\nfor my $fh (@fhlist) {\nvec($bits, fileno($fh), 1) = 1;\n}\nreturn $bits;\n}\nmy $rin = fhbits(\\*STDIN, $tty, $mysock);\n\nThe usual idiom is:\n\nmy ($nfound, $timeleft) =\nselect(my $rout = $rin, my $wout = $win, my $eout = $ein,\n$timeout);\n\nor to block until something becomes ready just do this\n\nmy $nfound =\nselect(my $rout = $rin, my $wout = $win, my $eout = $ein, undef);\n\nMost systems do not bother to return anything useful in $timeleft, so calling \"select\" in\nscalar context just returns $nfound.\n\nAny of the bit masks can also be \"undef\".  The timeout, if specified, is in seconds,\nwhich may be fractional.  Note: not all implementations are capable of returning the\n$timeleft.  If not, they always return $timeleft equal to the supplied $timeout.\n\nYou can effect a sleep of 250 milliseconds this way:\n\nselect(undef, undef, undef, 0.25);\n\nNote that whether \"select\" gets restarted after signals (say, SIGALRM) is implementation-\ndependent.  See also perlport for notes on the portability of \"select\".\n\nOn error, \"select\" behaves just like select(2): it returns \"-1\" and sets $!.\n\nOn some Unixes, select(2) may report a socket file descriptor as \"ready for reading\" even\nwhen no data is available, and thus any subsequent \"read\" would block.  This can be\navoided if you always use \"ONONBLOCK\" on the socket.  See select(2) and fcntl(2) for\nfurther details.\n\nThe standard \"IO::Select\" module provides a user-friendlier interface to \"select\", mostly\nbecause it does all the bit-mask work for you.\n\nWARNING: One should not attempt to mix buffered I/O (like \"read\" or \"readline\") with\n\"select\", except as permitted by POSIX, and even then only on POSIX systems.  You have to\nuse \"sysread\" instead.\n\nPortability issues: \"select\" in perlport.\n\nsemctl ID,SEMNUM,CMD,ARG\nCalls the System V IPC function semctl(2).  You'll probably have to say\n\nuse IPC::SysV;\n\nfirst to get the correct constant definitions.  If CMD is IPCSTAT or GETALL, then ARG\nmust be a variable that will hold the returned semidds structure or semaphore value\narray.  Returns like \"ioctl\": the undefined value for error, \"\"0 but true\"\" for zero, or\nthe actual return value otherwise.  The ARG must consist of a vector of native short\nintegers, which may be created with \"pack(\"s!\",(0)x$nsem)\".  See also \"SysV IPC\" in\nperlipc and the documentation for \"IPC::SysV\" and \"IPC::Semaphore\".\n\nPortability issues: \"semctl\" in perlport.\n\nsemget KEY,NSEMS,FLAGS\nCalls the System V IPC function semget(2).  Returns the semaphore id, or the undefined\nvalue on error.  See also \"SysV IPC\" in perlipc and the documentation for \"IPC::SysV\" and\n\"IPC::Semaphore\".\n\nPortability issues: \"semget\" in perlport.\n\nsemop KEY,OPSTRING\nCalls the System V IPC function semop(2) for semaphore operations such as signalling and\nwaiting.  OPSTRING must be a packed array of semop structures.  Each semop structure can\nbe generated with \"pack(\"s!3\", $semnum, $semop, $semflag)\".  The length of OPSTRING\nimplies the number of semaphore operations.  Returns true if successful, false on error.\nAs an example, the following code waits on semaphore $semnum of semaphore id $semid:\n\nmy $semop = pack(\"s!3\", $semnum, -1, 0);\ndie \"Semaphore trouble: $!\\n\" unless semop($semid, $semop);\n\nTo signal the semaphore, replace \"-1\" with 1.  See also \"SysV IPC\" in perlipc and the\ndocumentation for \"IPC::SysV\" and \"IPC::Semaphore\".\n\nPortability issues: \"semop\" in perlport.\n\nsend SOCKET,MSG,FLAGS,TO\nsend SOCKET,MSG,FLAGS\nSends a message on a socket.  Attempts to send the scalar MSG to the SOCKET filehandle.\nTakes the same flags as the system call of the same name.  On unconnected sockets, you\nmust specify a destination to send to, in which case it does a sendto(2) syscall.\nReturns the number of characters sent, or the undefined value on error.  The sendmsg(2)\nsyscall is currently unimplemented.  See \"UDP: Message Passing\" in perlipc for examples.\n\nNote that if the socket has been marked as \":utf8\", \"send\" will throw an exception.  The\n\":encoding(...)\" layer implicitly introduces the \":utf8\" layer.  See \"binmode\".\n\nsetpgrp PID,PGRP\nSets the current process group for the specified PID, 0 for the current process.  Raises\nan exception when used on a machine that doesn't implement POSIX setpgid(2) or BSD\nsetpgrp(2).  If the arguments are omitted, it defaults to \"0,0\".  Note that the BSD 4.2\nversion of \"setpgrp\" does not accept any arguments, so only \"setpgrp(0,0)\" is portable.\nSee also \"POSIX::setsid()\".\n\nPortability issues: \"setpgrp\" in perlport.\n\nsetpriority WHICH,WHO,PRIORITY\nSets the current priority for a process, a process group, or a user.  (See\nsetpriority(2).)  Raises an exception when used on a machine that doesn't implement\nsetpriority(2).\n\n\"WHICH\" can be any of \"PRIOPROCESS\", \"PRIOPGRP\" or \"PRIOUSER\" imported from \"RESOURCE\nCONSTANTS\" in POSIX.\n\nPortability issues: \"setpriority\" in perlport.\n\nsetsockopt SOCKET,LEVEL,OPTNAME,OPTVAL\nSets the socket option requested.  Returns \"undef\" on error.  Use integer constants\nprovided by the \"Socket\" module for LEVEL and OPNAME.  Values for LEVEL can also be\nobtained from getprotobyname.  OPTVAL might either be a packed string or an integer.  An\ninteger OPTVAL is shorthand for pack(\"i\", OPTVAL).\n\nAn example disabling Nagle's algorithm on a socket:\n\nuse Socket qw(IPPROTOTCP TCPNODELAY);\nsetsockopt($socket, IPPROTOTCP, TCPNODELAY, 1);\n\nPortability issues: \"setsockopt\" in perlport.\n\nshift ARRAY\nshift\nShifts the first value of the array off and returns it, shortening the array by 1 and\nmoving everything down.  If there are no elements in the array, returns the undefined\nvalue.  If ARRAY is omitted, shifts the @ array within the lexical scope of subroutines\nand formats, and the @ARGV array outside a subroutine and also within the lexical scopes\nestablished by the \"eval STRING\", \"BEGIN {}\", \"INIT {}\", \"CHECK {}\", \"UNITCHECK {}\", and\n\"END {}\" constructs.\n\nStarting with Perl 5.14, an experimental feature allowed \"shift\" to take a scalar\nexpression. This experiment has been deemed unsuccessful, and was removed as of Perl\n5.24.\n\nSee also \"unshift\", \"push\", and \"pop\".  \"shift\" and \"unshift\" do the same thing to the\nleft end of an array that \"pop\" and \"push\" do to the right end.\n\nshmctl ID,CMD,ARG\nCalls the System V IPC function shmctl.  You'll probably have to say\n\nuse IPC::SysV;\n\nfirst to get the correct constant definitions.  If CMD is \"IPCSTAT\", then ARG must be a\nvariable that will hold the returned \"shmidds\" structure.  Returns like ioctl: \"undef\"\nfor error; \"0 but true\" for zero; and the actual return value otherwise.  See also \"SysV\nIPC\" in perlipc and the documentation for \"IPC::SysV\".\n\nPortability issues: \"shmctl\" in perlport.\n\nshmget KEY,SIZE,FLAGS\nCalls the System V IPC function shmget.  Returns the shared memory segment id, or \"undef\"\non error.  See also \"SysV IPC\" in perlipc and the documentation for \"IPC::SysV\".\n\nPortability issues: \"shmget\" in perlport.\n\nshmread ID,VAR,POS,SIZE\nshmwrite ID,STRING,POS,SIZE\nReads or writes the System V shared memory segment ID starting at position POS for size\nSIZE by attaching to it, copying in/out, and detaching from it.  When reading, VAR must\nbe a variable that will hold the data read.  When writing, if STRING is too long, only\nSIZE bytes are used; if STRING is too short, nulls are written to fill out SIZE bytes.\nReturn true if successful, false on error.  \"shmread\" taints the variable.  See also\n\"SysV IPC\" in perlipc and the documentation for \"IPC::SysV\" and the \"IPC::Shareable\"\nmodule from CPAN.\n\nPortability issues: \"shmread\" in perlport and \"shmwrite\" in perlport.\n\nshutdown SOCKET,HOW\nShuts down a socket connection in the manner indicated by HOW, which has the same\ninterpretation as in the syscall of the same name.\n\nshutdown($socket, 0);    # I/we have stopped reading data\nshutdown($socket, 1);    # I/we have stopped writing data\nshutdown($socket, 2);    # I/we have stopped using this socket\n\nThis is useful with sockets when you want to tell the other side you're done writing but\nnot done reading, or vice versa.  It's also a more insistent form of close because it\nalso disables the file descriptor in any forked copies in other processes.\n\nReturns 1 for success; on error, returns \"undef\" if the first argument is not a valid\nfilehandle, or returns 0 and sets $! for any other failure.\n\nsin EXPR\nsin Returns the sine of EXPR (expressed in radians).  If EXPR is omitted, returns sine of $.\n\nFor the inverse sine operation, you may use the \"Math::Trig::asin\" function, or use this\nrelation:\n\nsub asin { atan2($[0], sqrt(1 - $[0] * $[0])) }\n\nsleep EXPR\nsleep\nCauses the script to sleep for (integer) EXPR seconds, or forever if no argument is\ngiven.  Returns the integer number of seconds actually slept.\n\nEXPR should be a positive integer. If called with a negative integer, \"sleep\" does not\nsleep but instead emits a warning, sets $! (\"errno\"), and returns zero.\n\n\"sleep 0\" is permitted, but a function call to the underlying platform implementation\nstill occurs, with any side effects that may have.  \"sleep 0\" is therefore not exactly\nidentical to not sleeping at all.\n\nMay be interrupted if the process receives a signal such as \"SIGALRM\".\n\neval {\nlocal $SIG{ALRM} = sub { die \"Alarm!\\n\" };\nsleep;\n};\ndie $@ unless $@ eq \"Alarm!\\n\";\n\nYou probably cannot mix \"alarm\" and \"sleep\" calls, because \"sleep\" is often implemented\nusing \"alarm\".\n\nOn some older systems, it may sleep up to a full second less than what you requested,\ndepending on how it counts seconds.  Most modern systems always sleep the full amount.\nThey may appear to sleep longer than that, however, because your process might not be\nscheduled right away in a busy multitasking system.\n\nFor delays of finer granularity than one second, the Time::HiRes module (from CPAN, and\nstarting from Perl 5.8 part of the standard distribution) provides \"usleep\".  You may\nalso use Perl's four-argument version of \"select\" leaving the first three arguments\nundefined, or you might be able to use the \"syscall\" interface to access setitimer(2) if\nyour system supports it.  See perlfaq8 for details.\n\nSee also the POSIX module's \"pause\" function.\n\nsocket SOCKET,DOMAIN,TYPE,PROTOCOL\nOpens a socket of the specified kind and attaches it to filehandle SOCKET.  DOMAIN, TYPE,\nand PROTOCOL are specified the same as for the syscall of the same name.  You should \"use\nSocket\" first to get the proper definitions imported.  See the examples in \"Sockets:\nClient/Server Communication\" in perlipc.\n\nOn systems that support a close-on-exec flag on files, the flag will be set for the newly\nopened file descriptor, as determined by the value of $^F.  See \"$^F\" in perlvar.\n\nsocketpair SOCKET1,SOCKET2,DOMAIN,TYPE,PROTOCOL\nCreates an unnamed pair of sockets in the specified domain, of the specified type.\nDOMAIN, TYPE, and PROTOCOL are specified the same as for the syscall of the same name.\nIf unimplemented, raises an exception.  Returns true if successful.\n\nOn systems that support a close-on-exec flag on files, the flag will be set for the newly\nopened file descriptors, as determined by the value of $^F.  See \"$^F\" in perlvar.\n\nSome systems define \"pipe\" in terms of \"socketpair\", in which a call to \"pipe($rdr,\n$wtr)\" is essentially:\n\nuse Socket;\nsocketpair(my $rdr, my $wtr, AFUNIX, SOCKSTREAM, PFUNSPEC);\nshutdown($rdr, 1);        # no more writing for reader\nshutdown($wtr, 0);        # no more reading for writer\n\nSee perlipc for an example of socketpair use.  Perl 5.8 and later will emulate socketpair\nusing IP sockets to localhost if your system implements sockets but not socketpair.\n\nPortability issues: \"socketpair\" in perlport.\n\nsort SUBNAME LIST\nsort BLOCK LIST\nsort LIST\nIn list context, this sorts the LIST and returns the sorted list value.  In scalar\ncontext, the behaviour of \"sort\" is undefined.\n\nIf SUBNAME or BLOCK is omitted, \"sort\"s in standard string comparison order.  If SUBNAME\nis specified, it gives the name of a subroutine that returns an integer less than, equal\nto, or greater than 0, depending on how the elements of the list are to be ordered.  (The\n\"<=>\" and \"cmp\" operators are extremely useful in such routines.)  SUBNAME may be a\nscalar variable name (unsubscripted), in which case the value provides the name of (or a\nreference to) the actual subroutine to use.  In place of a SUBNAME, you can provide a\nBLOCK as an anonymous, in-line sort subroutine.\n\nIf the subroutine's prototype is \"($$)\", the elements to be compared are passed by\nreference in @, as for a normal subroutine.  This is slower than unprototyped\nsubroutines, where the elements to be compared are passed into the subroutine as the\npackage global variables $a and $b (see example below).\n\nIf the subroutine is an XSUB, the elements to be compared are pushed on to the stack, the\nway arguments are usually passed to XSUBs.  $a and $b are not set.\n\nThe values to be compared are always passed by reference and should not be modified.\n\nYou also cannot exit out of the sort block or subroutine using any of the loop control\noperators described in perlsyn or with \"goto\".\n\nWhen \"use locale\" (but not \"use locale ':notcharacters'\") is in effect, \"sort LIST\"\nsorts LIST according to the current collation locale.  See perllocale.\n\n\"sort\" returns aliases into the original list, much as a for loop's index variable\naliases the list elements.  That is, modifying an element of a list returned by \"sort\"\n(for example, in a \"foreach\", \"map\" or \"grep\") actually modifies the element in the\noriginal list.  This is usually something to be avoided when writing clear code.\n\nHistorically Perl has varied in whether sorting is stable by default.  If stability\nmatters, it can be controlled explicitly by using the sort pragma.\n\nExamples:\n\n# sort lexically\nmy @articles = sort @files;\n\n# same thing, but with explicit sort routine\nmy @articles = sort {$a cmp $b} @files;\n\n# now case-insensitively\nmy @articles = sort {fc($a) cmp fc($b)} @files;\n\n# same thing in reversed order\nmy @articles = sort {$b cmp $a} @files;\n\n# sort numerically ascending\nmy @articles = sort {$a <=> $b} @files;\n\n# sort numerically descending\nmy @articles = sort {$b <=> $a} @files;\n\n# this sorts the %age hash by value instead of key\n# using an in-line function\nmy @eldest = sort { $age{$b} <=> $age{$a} } keys %age;\n\n# sort using explicit subroutine name\nsub byage {\n$age{$a} <=> $age{$b};  # presuming numeric\n}\nmy @sortedclass = sort byage @class;\n\nsub backwards { $b cmp $a }\nmy @harry  = qw(dog cat x Cain Abel);\nmy @george = qw(gone chased yz Punished Axed);\nprint sort @harry;\n# prints AbelCaincatdogx\nprint sort backwards @harry;\n# prints xdogcatCainAbel\nprint sort @george, 'to', @harry;\n# prints AbelAxedCainPunishedcatchaseddoggonetoxyz\n\n# inefficiently sort by descending numeric compare using\n# the first integer after the first = sign, or the\n# whole record case-insensitively otherwise\n\nmy @new = sort {\n($b =~ /=(\\d+)/)[0] <=> ($a =~ /=(\\d+)/)[0]\n||\nfc($a)  cmp  fc($b)\n} @old;\n\n# same thing, but much more efficiently;\n# we'll build auxiliary indices instead\n# for speed\nmy (@nums, @caps);\nfor (@old) {\npush @nums, ( /=(\\d+)/ ? $1 : undef );\npush @caps, fc($);\n}\n\nmy @new = @old[ sort {\n$nums[$b] <=> $nums[$a]\n||\n$caps[$a] cmp $caps[$b]\n} 0..$#old\n];\n\n# same thing, but without any temps\nmy @new = map { $->[0] }\nsort { $b->[1] <=> $a->[1]\n||\n$a->[2] cmp $b->[2]\n} map { [$, /=(\\d+)/, fc($)] } @old;\n\n# using a prototype allows you to use any comparison subroutine\n# as a sort subroutine (including other package's subroutines)\npackage Other;\nsub backwards ($$) { $[1] cmp $[0]; }  # $a and $b are\n# not set here\npackage main;\nmy @new = sort Other::backwards @old;\n\n# guarantee stability\nuse sort 'stable';\nmy @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old;\n\nWarning: syntactical care is required when sorting the list returned from a function.  If\nyou want to sort the list returned by the function call \"findrecords(@key)\", you can\nuse:\n\nmy @contact = sort { $a cmp $b } findrecords @key;\nmy @contact = sort +findrecords(@key);\nmy @contact = sort &findrecords(@key);\nmy @contact = sort(findrecords(@key));\n\nIf instead you want to sort the array @key with the comparison routine \"findrecords()\"\nthen you can use:\n\nmy @contact = sort { findrecords() } @key;\nmy @contact = sort findrecords(@key);\nmy @contact = sort(findrecords @key);\nmy @contact = sort(findrecords (@key));\n\n$a and $b are set as package globals in the package the sort() is called from.  That\nmeans $main::a and $main::b (or $::a and $::b) in the \"main\" package, $FooPack::a and\n$FooPack::b in the \"FooPack\" package, etc.  If the sort block is in scope of a \"my\" or\n\"state\" declaration of $a and/or $b, you must spell out the full name of the variables in\nthe sort block :\n\npackage main;\nmy $a = \"C\"; # DANGER, Will Robinson, DANGER !!!\n\nprint sort { $a cmp $b }               qw(A C E G B D F H);\n# WRONG\nsub badlexi { $a cmp $b }\nprint sort badlexi                     qw(A C E G B D F H);\n# WRONG\n# the above prints BACFEDGH or some other incorrect ordering\n\nprint sort { $::a cmp $::b }           qw(A C E G B D F H);\n# OK\nprint sort { our $a cmp our $b }       qw(A C E G B D F H);\n# also OK\nprint sort { our ($a, $b); $a cmp $b } qw(A C E G B D F H);\n# also OK\nsub lexi { our $a cmp our $b }\nprint sort lexi                        qw(A C E G B D F H);\n# also OK\n# the above print ABCDEFGH\n\nWith proper care you may mix package and my (or state) $a and/or $b:\n\nmy $a = {\ntiny   => -2,\nsmall  => -1,\nnormal => 0,\nbig    => 1,\nhuge   => 2\n};\n\nsay sort { $a->{our $a} <=> $a->{our $b} }\nqw{ huge normal tiny small big};\n\n# prints tinysmallnormalbighuge\n\n$a and $b are implicitly local to the sort() execution and regain their former values\nupon completing the sort.\n\nSort subroutines written using $a and $b are bound to their calling package. It is\npossible, but of limited interest, to define them in a different package, since the\nsubroutine must still refer to the calling package's $a and $b :\n\npackage Foo;\nsub lexi { $Bar::a cmp $Bar::b }\npackage Bar;\n... sort Foo::lexi ...\n\nUse the prototyped versions (see above) for a more generic alternative.\n\nThe comparison function is required to behave.  If it returns inconsistent results\n(sometimes saying $x[1] is less than $x[2] and sometimes saying the opposite, for\nexample) the results are not well-defined.\n\nBecause \"<=>\" returns \"undef\" when either operand is \"NaN\" (not-a-number), be careful\nwhen sorting with a comparison function like \"$a <=> $b\" any lists that might contain a\n\"NaN\".  The following example takes advantage that \"NaN != NaN\" to eliminate any \"NaN\"s\nfrom the input list.\n\nmy @result = sort { $a <=> $b } grep { $ == $ } @input;\n\nIn this version of perl, the \"sort\" function is implemented via the mergesort algorithm.\n\nsplice ARRAY,OFFSET,LENGTH,LIST\nsplice ARRAY,OFFSET,LENGTH\nsplice ARRAY,OFFSET\nsplice ARRAY\nRemoves the elements designated by OFFSET and LENGTH from an array, and replaces them\nwith the elements of LIST, if any.  In list context, returns the elements removed from\nthe array.  In scalar context, returns the last element removed, or \"undef\" if no\nelements are removed.  The array grows or shrinks as necessary.  If OFFSET is negative\nthen it starts that far from the end of the array.  If LENGTH is omitted, removes\neverything from OFFSET onward.  If LENGTH is negative, removes the elements from OFFSET\nonward except for -LENGTH elements at the end of the array.  If both OFFSET and LENGTH\nare omitted, removes everything.  If OFFSET is past the end of the array and a LENGTH was\nprovided, Perl issues a warning, and splices at the end of the array.\n\nThe following equivalences hold (assuming \"$#a >= $i\" )\n\npush(@a,$x,$y)      splice(@a,@a,0,$x,$y)\npop(@a)             splice(@a,-1)\nshift(@a)           splice(@a,0,1)\nunshift(@a,$x,$y)   splice(@a,0,0,$x,$y)\n$a[$i] = $y         splice(@a,$i,1,$y)\n\n\"splice\" can be used, for example, to implement n-ary queue processing:\n\nsub naryprint {\nmy $n = shift;\nwhile (my @nextn = splice @, 0, $n) {\nsay join q{ -- }, @nextn;\n}\n}\n\nnaryprint(3, qw(a b c d e f g h));\n# prints:\n#   a -- b -- c\n#   d -- e -- f\n#   g -- h\n\nStarting with Perl 5.14, an experimental feature allowed \"splice\" to take a scalar\nexpression. This experiment has been deemed unsuccessful, and was removed as of Perl\n5.24.\n\nsplit /PATTERN/,EXPR,LIMIT\nsplit /PATTERN/,EXPR\nsplit /PATTERN/\nsplit\nSplits the string EXPR into a list of strings and returns the list in list context, or\nthe size of the list in scalar context.  (Prior to Perl 5.11, it also overwrote @ with\nthe list in void and scalar context. If you target old perls, beware.)\n\nIf only PATTERN is given, EXPR defaults to $.\n\nAnything in EXPR that matches PATTERN is taken to be a separator that separates the EXPR\ninto substrings (called \"fields\") that do not include the separator.  Note that a\nseparator may be longer than one character or even have no characters at all (the empty\nstring, which is a zero-width match).\n\nThe PATTERN need not be constant; an expression may be used to specify a pattern that\nvaries at runtime.\n\nIf PATTERN matches the empty string, the EXPR is split at the match position (between\ncharacters).  As an example, the following:\n\nmy @x = split(/b/, \"abc\"); # (\"a\", \"c\")\n\nuses the \"b\" in 'abc' as a separator to produce the list (\"a\", \"c\").  However, this:\n\nmy @x = split(//, \"abc\"); # (\"a\", \"b\", \"c\")\n\nuses empty string matches as separators; thus, the empty string may be used to split EXPR\ninto a list of its component characters.\n\nAs a special case for \"split\", the empty pattern given in match operator syntax (\"//\")\nspecifically matches the empty string, which is contrary to its usual interpretation as\nthe last successful match.\n\nIf PATTERN is \"/^/\", then it is treated as if it used the multiline modifier (\"/^/m\"),\nsince it isn't much use otherwise.\n\n\"/m\" and any of the other pattern modifiers valid for \"qr\" (summarized in\n\"qr/STRING/msixpodualn\" in perlop) may be specified explicitly.\n\nAs another special case, \"split\" emulates the default behavior of the command line tool\nawk when the PATTERN is either omitted or a string composed of a single space character\n(such as ' ' or \"\\x20\", but not e.g. \"/ /\").  In this case, any leading whitespace in\nEXPR is removed before splitting occurs, and the PATTERN is instead treated as if it were\n\"/\\s+/\"; in particular, this means that any contiguous whitespace (not just a single\nspace character) is used as a separator.\n\nmy @x = split(\" \", \"  Quick brown fox\\n\");\n# (\"Quick\", \"brown\", \"fox\")\n\nmy @x = split(\" \", \"RED\\tGREEN\\tBLUE\");\n# (\"RED\", \"GREEN\", \"BLUE\")\n\nUsing split in this fashion is very similar to how \"qw//\" works.\n\nHowever, this special treatment can be avoided by specifying the pattern \"/ /\" instead of\nthe string \" \", thereby allowing only a single space character to be a separator.  In\nearlier Perls this special case was restricted to the use of a plain \" \" as the pattern\nargument to split; in Perl 5.18.0 and later this special case is triggered by any\nexpression which evaluates to the simple string \" \".\n\nAs of Perl 5.28, this special-cased whitespace splitting works as expected in the scope\nof \"use feature 'unicodestrings'\". In previous versions, and outside the scope of that\nfeature, it exhibits \"The \"Unicode Bug\"\" in perlunicode: characters that are whitespace\naccording to Unicode rules but not according to ASCII rules can be treated as part of\nfields rather than as field separators, depending on the string's internal encoding.\n\nIf omitted, PATTERN defaults to a single space, \" \", triggering the previously described\nawk emulation.\n\nIf LIMIT is specified and positive, it represents the maximum number of fields into which\nthe EXPR may be split; in other words, LIMIT is one greater than the maximum number of\ntimes EXPR may be split.  Thus, the LIMIT value 1 means that EXPR may be split a maximum\nof zero times, producing a maximum of one field (namely, the entire value of EXPR).  For\ninstance:\n\nmy @x = split(//, \"abc\", 1); # (\"abc\")\nmy @x = split(//, \"abc\", 2); # (\"a\", \"bc\")\nmy @x = split(//, \"abc\", 3); # (\"a\", \"b\", \"c\")\nmy @x = split(//, \"abc\", 4); # (\"a\", \"b\", \"c\")\n\nIf LIMIT is negative, it is treated as if it were instead arbitrarily large; as many\nfields as possible are produced.\n\nIf LIMIT is omitted (or, equivalently, zero), then it is usually treated as if it were\ninstead negative but with the exception that trailing empty fields are stripped (empty\nleading fields are always preserved); if all fields are empty, then all fields are\nconsidered to be trailing (and are thus stripped in this case).  Thus, the following:\n\nmy @x = split(/,/, \"a,b,c,,,\"); # (\"a\", \"b\", \"c\")\n\nproduces only a three element list.\n\nmy @x = split(/,/, \"a,b,c,,,\", -1); # (\"a\", \"b\", \"c\", \"\", \"\", \"\")\n\nproduces a six element list.\n\nIn time-critical applications, it is worthwhile to avoid splitting into more fields than\nnecessary.  Thus, when assigning to a list, if LIMIT is omitted (or zero), then LIMIT is\ntreated as though it were one larger than the number of variables in the list; for the\nfollowing, LIMIT is implicitly 3:\n\nmy ($login, $passwd) = split(/:/);\n\nNote that splitting an EXPR that evaluates to the empty string always produces zero\nfields, regardless of the LIMIT specified.\n\nAn empty leading field is produced when there is a positive-width match at the beginning\nof EXPR.  For instance:\n\nmy @x = split(/ /, \" abc\"); # (\"\", \"abc\")\n\nsplits into two elements.  However, a zero-width match at the beginning of EXPR never\nproduces an empty field, so that:\n\nmy @x = split(//, \" abc\"); # (\" \", \"a\", \"b\", \"c\")\n\nsplits into four elements instead of five.\n\nAn empty trailing field, on the other hand, is produced when there is a match at the end\nof EXPR, regardless of the length of the match (of course, unless a non-zero LIMIT is\ngiven explicitly, such fields are removed, as in the last example).  Thus:\n\nmy @x = split(//, \" abc\", -1); # (\" \", \"a\", \"b\", \"c\", \"\")\n\nIf the PATTERN contains capturing groups, then for each separator, an additional field is\nproduced for each substring captured by a group (in the order in which the groups are\nspecified, as per backreferences); if any group does not match, then it captures the\n\"undef\" value instead of a substring.  Also, note that any such additional field is\nproduced whenever there is a separator (that is, whenever a split occurs), and such an\nadditional field does not count towards the LIMIT.  Consider the following expressions\nevaluated in list context (each returned list is provided in the associated comment):\n\nmy @x = split(/-|,/    , \"1-10,20\", 3);\n# (\"1\", \"10\", \"20\")\n\nmy @x = split(/(-|,)/  , \"1-10,20\", 3);\n# (\"1\", \"-\", \"10\", \",\", \"20\")\n\nmy @x = split(/-|(,)/  , \"1-10,20\", 3);\n# (\"1\", undef, \"10\", \",\", \"20\")\n\nmy @x = split(/(-)|,/  , \"1-10,20\", 3);\n# (\"1\", \"-\", \"10\", undef, \"20\")\n\nmy @x = split(/(-)|(,)/, \"1-10,20\", 3);\n# (\"1\", \"-\", undef, \"10\", undef, \",\", \"20\")\n\nsprintf FORMAT, LIST\nReturns a string formatted by the usual \"printf\" conventions of the C library function\n\"sprintf\".  See below for more details and see sprintf(3) or printf(3) on your system for\nan explanation of the general principles.\n\nFor example:\n\n# Format number with up to 8 leading zeroes\nmy $result = sprintf(\"%08d\", $number);\n\n# Round number to 3 digits after decimal point\nmy $rounded = sprintf(\"%.3f\", $number);\n\nPerl does its own \"sprintf\" formatting: it emulates the C function sprintf(3), but\ndoesn't use it except for floating-point numbers, and even then only standard modifiers\nare allowed.  Non-standard extensions in your local sprintf(3) are therefore unavailable\nfrom Perl.\n\nUnlike \"printf\", \"sprintf\" does not do what you probably mean when you pass it an array\nas your first argument.  The array is given scalar context, and instead of using the 0th\nelement of the array as the format, Perl will use the count of elements in the array as\nthe format, which is almost never useful.\n\nPerl's \"sprintf\" permits the following universally-known conversions:\n\n%%    a percent sign\n%c    a character with the given number\n%s    a string\n%d    a signed integer, in decimal\n%u    an unsigned integer, in decimal\n%o    an unsigned integer, in octal\n%x    an unsigned integer, in hexadecimal\n%e    a floating-point number, in scientific notation\n%f    a floating-point number, in fixed decimal notation\n%g    a floating-point number, in %e or %f notation\n\nIn addition, Perl permits the following widely-supported conversions:\n\n%X    like %x, but using upper-case letters\n%E    like %e, but using an upper-case \"E\"\n%G    like %g, but with an upper-case \"E\" (if applicable)\n%b    an unsigned integer, in binary\n%B    like %b, but using an upper-case \"B\" with the # flag\n%p    a pointer (outputs the Perl value's address in hexadecimal)\n%n    special: *stores* the number of characters output so far\ninto the next argument in the parameter list\n%a    hexadecimal floating point\n%A    like %a, but using upper-case letters\n\nFinally, for backward (and we do mean \"backward\") compatibility, Perl permits these\nunnecessary but widely-supported conversions:\n\n%i    a synonym for %d\n%D    a synonym for %ld\n%U    a synonym for %lu\n%O    a synonym for %lo\n%F    a synonym for %f\n\nNote that the number of exponent digits in the scientific notation produced by %e, %E, %g\nand %G for numbers with the modulus of the exponent less than 100 is system-dependent: it\nmay be three or less (zero-padded as necessary).  In other words, 1.23 times ten to the\n99th may be either \"1.23e99\" or \"1.23e099\".  Similarly for %a and %A: the exponent or the\nhexadecimal digits may float: especially the \"long doubles\" Perl configuration option may\ncause surprises.\n\nBetween the \"%\" and the format letter, you may specify several additional attributes\ncontrolling the interpretation of the format.  In order, these are:\n\nformat parameter index\nAn explicit format parameter index, such as \"2$\".  By default sprintf will format the\nnext unused argument in the list, but this allows you to take the arguments out of\norder:\n\nprintf '%2$d %1$d', 12, 34;      # prints \"34 12\"\nprintf '%3$d %d %1$d', 1, 2, 3;  # prints \"3 1 1\"\n\nflags\none or more of:\n\nspace   prefix non-negative number with a space\n+       prefix non-negative number with a plus sign\n-       left-justify within the field\n0       use zeros, not spaces, to right-justify\n#       ensure the leading \"0\" for any octal,\nprefix non-zero hexadecimal with \"0x\" or \"0X\",\nprefix non-zero binary with \"0b\" or \"0B\"\n\nFor example:\n\nprintf '<% d>',  12;   # prints \"< 12>\"\nprintf '<% d>',   0;   # prints \"< 0>\"\nprintf '<% d>', -12;   # prints \"<-12>\"\nprintf '<%+d>',  12;   # prints \"<+12>\"\nprintf '<%+d>',   0;   # prints \"<+0>\"\nprintf '<%+d>', -12;   # prints \"<-12>\"\nprintf '<%6s>',  12;   # prints \"<    12>\"\nprintf '<%-6s>', 12;   # prints \"<12    >\"\nprintf '<%06s>', 12;   # prints \"<000012>\"\nprintf '<%#o>',  12;   # prints \"<014>\"\nprintf '<%#x>',  12;   # prints \"<0xc>\"\nprintf '<%#X>',  12;   # prints \"<0XC>\"\nprintf '<%#b>',  12;   # prints \"<0b1100>\"\nprintf '<%#B>',  12;   # prints \"<0B1100>\"\n\nWhen a space and a plus sign are given as the flags at once, the space is ignored.\n\nprintf '<%+ d>', 12;   # prints \"<+12>\"\nprintf '<% +d>', 12;   # prints \"<+12>\"\n\nWhen the # flag and a precision are given in the %o conversion, the precision is\nincremented if it's necessary for the leading \"0\".\n\nprintf '<%#.5o>', 012;      # prints \"<00012>\"\nprintf '<%#.5o>', 012345;   # prints \"<012345>\"\nprintf '<%#.0o>', 0;        # prints \"<0>\"\n\nvector flag\nThis flag tells Perl to interpret the supplied string as a vector of integers, one\nfor each character in the string.  Perl applies the format to each integer in turn,\nthen joins the resulting strings with a separator (a dot \".\" by default).  This can\nbe useful for displaying ordinal values of characters in arbitrary strings:\n\nprintf \"%vd\", \"AB\\x{100}\";           # prints \"65.66.256\"\nprintf \"version is v%vd\\n\", $^V;     # Perl's version\n\nPut an asterisk \"*\" before the \"v\" to override the string to use to separate the\nnumbers:\n\nprintf \"address is %*vX\\n\", \":\", $addr;   # IPv6 address\nprintf \"bits are %0*v8b\\n\", \" \", $bits;   # random bitstring\n\nYou can also explicitly specify the argument number to use for the join string using\nsomething like \"*2$v\"; for example:\n\nprintf '%*4$vX %*4$vX %*4$vX',       # 3 IPv6 addresses\n@addr[1..3], \":\";\n\n(minimum) width\nArguments are usually formatted to be only as wide as required to display the given\nvalue.  You can override the width by putting a number here, or get the width from\nthe next argument (with \"*\") or from a specified argument (e.g., with \"*2$\"):\n\nprintf \"<%s>\", \"a\";       # prints \"<a>\"\nprintf \"<%6s>\", \"a\";      # prints \"<     a>\"\nprintf \"<%*s>\", 6, \"a\";   # prints \"<     a>\"\nprintf '<%*2$s>', \"a\", 6; # prints \"<     a>\"\nprintf \"<%2s>\", \"long\";   # prints \"<long>\" (does not truncate)\n\nIf a field width obtained through \"*\" is negative, it has the same effect as the \"-\"\nflag: left-justification.\n\nprecision, or maximum width\nYou can specify a precision (for numeric conversions) or a maximum width (for string\nconversions) by specifying a \".\" followed by a number.  For floating-point formats\nexcept \"g\" and \"G\", this specifies how many places right of the decimal point to show\n(the default being 6).  For example:\n\n# these examples are subject to system-specific variation\nprintf '<%f>', 1;    # prints \"<1.000000>\"\nprintf '<%.1f>', 1;  # prints \"<1.0>\"\nprintf '<%.0f>', 1;  # prints \"<1>\"\nprintf '<%e>', 10;   # prints \"<1.000000e+01>\"\nprintf '<%.1e>', 10; # prints \"<1.0e+01>\"\n\nFor \"g\" and \"G\", this specifies the maximum number of significant digits to show; for\nexample:\n\n# These examples are subject to system-specific variation.\nprintf '<%g>', 1;        # prints \"<1>\"\nprintf '<%.10g>', 1;     # prints \"<1>\"\nprintf '<%g>', 100;      # prints \"<100>\"\nprintf '<%.1g>', 100;    # prints \"<1e+02>\"\nprintf '<%.2g>', 100.01; # prints \"<1e+02>\"\nprintf '<%.5g>', 100.01; # prints \"<100.01>\"\nprintf '<%.4g>', 100.01; # prints \"<100>\"\nprintf '<%.1g>', 0.0111; # prints \"<0.01>\"\nprintf '<%.2g>', 0.0111; # prints \"<0.011>\"\nprintf '<%.3g>', 0.0111; # prints \"<0.0111>\"\n\nFor integer conversions, specifying a precision implies that the output of the number\nitself should be zero-padded to this width, where the 0 flag is ignored:\n\nprintf '<%.6d>', 1;      # prints \"<000001>\"\nprintf '<%+.6d>', 1;     # prints \"<+000001>\"\nprintf '<%-10.6d>', 1;   # prints \"<000001    >\"\nprintf '<%10.6d>', 1;    # prints \"<    000001>\"\nprintf '<%010.6d>', 1;   # prints \"<    000001>\"\nprintf '<%+10.6d>', 1;   # prints \"<   +000001>\"\n\nprintf '<%.6x>', 1;      # prints \"<000001>\"\nprintf '<%#.6x>', 1;     # prints \"<0x000001>\"\nprintf '<%-10.6x>', 1;   # prints \"<000001    >\"\nprintf '<%10.6x>', 1;    # prints \"<    000001>\"\nprintf '<%010.6x>', 1;   # prints \"<    000001>\"\nprintf '<%#10.6x>', 1;   # prints \"<  0x000001>\"\n\nFor string conversions, specifying a precision truncates the string to fit the\nspecified width:\n\nprintf '<%.5s>', \"truncated\";   # prints \"<trunc>\"\nprintf '<%10.5s>', \"truncated\"; # prints \"<     trunc>\"\n\nYou can also get the precision from the next argument using \".*\", or from a specified\nargument (e.g., with \".*2$\"):\n\nprintf '<%.6x>', 1;       # prints \"<000001>\"\nprintf '<%.*x>', 6, 1;    # prints \"<000001>\"\n\nprintf '<%.*2$x>', 1, 6;  # prints \"<000001>\"\n\nprintf '<%6.*2$x>', 1, 4; # prints \"<  0001>\"\n\nIf a precision obtained through \"*\" is negative, it counts as having no precision at\nall.\n\nprintf '<%.*s>',  7, \"string\";   # prints \"<string>\"\nprintf '<%.*s>',  3, \"string\";   # prints \"<str>\"\nprintf '<%.*s>',  0, \"string\";   # prints \"<>\"\nprintf '<%.*s>', -1, \"string\";   # prints \"<string>\"\n\nprintf '<%.*d>',  1, 0;   # prints \"<0>\"\nprintf '<%.*d>',  0, 0;   # prints \"<>\"\nprintf '<%.*d>', -1, 0;   # prints \"<0>\"\n\nsize\nFor numeric conversions, you can specify the size to interpret the number as using\n\"l\", \"h\", \"V\", \"q\", \"L\", or \"ll\".  For integer conversions (\"d u o x X b i D U O\"),\nnumbers are usually assumed to be whatever the default integer size is on your\nplatform (usually 32 or 64 bits), but you can override this to use instead one of the\nstandard C types, as supported by the compiler used to build Perl:\n\nhh          interpret integer as C type \"char\" or \"unsigned\nchar\" on Perl 5.14 or later\nh           interpret integer as C type \"short\" or\n\"unsigned short\"\nj           interpret integer as C type \"intmaxt\" on Perl\n5.14 or later; and prior to Perl 5.30, only with\na C99 compiler (unportable)\nl           interpret integer as C type \"long\" or\n\"unsigned long\"\nq, L, or ll interpret integer as C type \"long long\",\n\"unsigned long long\", or \"quad\" (typically\n64-bit integers)\nt           interpret integer as C type \"ptrdifft\" on Perl\n5.14 or later\nz           interpret integer as C types \"sizet\" or\n\"ssizet\" on Perl 5.14 or later\n\nNote that, in general, using the \"l\" modifier (for example, when writing \"%ld\" or\n\"%lu\" instead of \"%d\" and \"%u\") is unnecessary when used from Perl code.  Moreover,\nit may be harmful, for example on Windows 64-bit where a long is 32-bits.\n\nAs of 5.14, none of these raises an exception if they are not supported on your\nplatform.  However, if warnings are enabled, a warning of the \"printf\" warning class\nis issued on an unsupported conversion flag.  Should you instead prefer an exception,\ndo this:\n\nuse warnings FATAL => \"printf\";\n\nIf you would like to know about a version dependency before you start running the\nprogram, put something like this at its top:\n\nuse 5.014;  # for hh/j/t/z/ printf modifiers\n\nYou can find out whether your Perl supports quads via Config:\n\nuse Config;\nif ($Config{use64bitint} eq \"define\"\n|| $Config{longsize} >= 8) {\nprint \"Nice quads!\\n\";\n}\n\nFor floating-point conversions (\"e f g E F G\"), numbers are usually assumed to be the\ndefault floating-point size on your platform (double or long double), but you can\nforce \"long double\" with \"q\", \"L\", or \"ll\" if your platform supports them.  You can\nfind out whether your Perl supports long doubles via Config:\n\nuse Config;\nprint \"long doubles\\n\" if $Config{dlongdbl} eq \"define\";\n\nYou can find out whether Perl considers \"long double\" to be the default floating-\npoint size to use on your platform via Config:\n\nuse Config;\nif ($Config{uselongdouble} eq \"define\") {\nprint \"long doubles by default\\n\";\n}\n\nIt can also be that long doubles and doubles are the same thing:\n\nuse Config;\n($Config{doublesize} == $Config{longdblsize}) &&\nprint \"doubles are long doubles\\n\";\n\nThe size specifier \"V\" has no effect for Perl code, but is supported for\ncompatibility with XS code.  It means \"use the standard size for a Perl integer or\nfloating-point number\", which is the default.\n\norder of arguments\nNormally, \"sprintf\" takes the next unused argument as the value to format for each\nformat specification.  If the format specification uses \"*\" to require additional\narguments, these are consumed from the argument list in the order they appear in the\nformat specification before the value to format.  Where an argument is specified by\nan explicit index, this does not affect the normal order for the arguments, even when\nthe explicitly specified index would have been the next argument.\n\nSo:\n\nprintf \"<%*.*s>\", $a, $b, $c;\n\nuses $a for the width, $b for the precision, and $c as the value to format; while:\n\nprintf '<%*1$.*s>', $a, $b;\n\nwould use $a for the width and precision, and $b as the value to format.\n\nHere are some more examples; be aware that when using an explicit index, the \"$\" may\nneed escaping:\n\nprintf \"%2\\$d %d\\n\",      12, 34;     # will print \"34 12\\n\"\nprintf \"%2\\$d %d %d\\n\",   12, 34;     # will print \"34 12 34\\n\"\nprintf \"%3\\$d %d %d\\n\",   12, 34, 56; # will print \"56 12 34\\n\"\nprintf \"%2\\$*3\\$d %d\\n\",  12, 34,  3; # will print \" 34 12\\n\"\nprintf \"%*1\\$.*f\\n\",       4,  5, 10; # will print \"5.0000\\n\"\n\nIf \"use locale\" (including \"use locale ':notcharacters'\") is in effect and\n\"POSIX::setlocale\" has been called, the character used for the decimal separator in\nformatted floating-point numbers is affected by the \"LCNUMERIC\" locale.  See perllocale\nand POSIX.\n\nsqrt EXPR\nsqrt\nReturn the positive square root of EXPR.  If EXPR is omitted, uses $.  Works only for\nnon-negative operands unless you've loaded the \"Math::Complex\" module.\n\nuse Math::Complex;\nprint sqrt(-4);    # prints 2i\n\nsrand EXPR\nsrand\nSets and returns the random number seed for the \"rand\" operator.\n\nThe point of the function is to \"seed\" the \"rand\" function so that \"rand\" can produce a\ndifferent sequence each time you run your program.  When called with a parameter, \"srand\"\nuses that for the seed; otherwise it (semi-)randomly chooses a seed.  In either case,\nstarting with Perl 5.14, it returns the seed.  To signal that your code will work only on\nPerls of a recent vintage:\n\nuse 5.014;  # so srand returns the seed\n\nIf \"srand\" is not called explicitly, it is called implicitly without a parameter at the\nfirst use of the \"rand\" operator.  However, there are a few situations where programs are\nlikely to want to call \"srand\".  One is for generating predictable results, generally for\ntesting or debugging.  There, you use \"srand($seed)\", with the same $seed each time.\nAnother case is that you may want to call \"srand\" after a \"fork\" to avoid child processes\nsharing the same seed value as the parent (and consequently each other).\n\nDo not call \"srand()\" (i.e., without an argument) more than once per process.  The\ninternal state of the random number generator should contain more entropy than can be\nprovided by any seed, so calling \"srand\" again actually loses randomness.\n\nMost implementations of \"srand\" take an integer and will silently truncate decimal\nnumbers.  This means \"srand(42)\" will usually produce the same results as \"srand(42.1)\".\nTo be safe, always pass \"srand\" an integer.\n\nA typical use of the returned seed is for a test program which has too many combinations\nto test comprehensively in the time available to it each run.  It can test a random\nsubset each time, and should there be a failure, log the seed used for that run so that\nit can later be used to reproduce the same results.\n\n\"rand\" is not cryptographically secure.  You should not rely on it in security-sensitive\nsituations.  As of this writing, a number of third-party CPAN modules offer random number\ngenerators intended by their authors to be cryptographically secure, including:\nData::Entropy, Crypt::Random, Math::Random::Secure, and Math::TrulyRandom.\n\nstat FILEHANDLE\nstat EXPR\nstat DIRHANDLE\nstat\nReturns a 13-element list giving the status info for a file, either the file opened via\nFILEHANDLE or DIRHANDLE, or named by EXPR.  If EXPR is omitted, it stats $ (not \"\"!).\nReturns the empty list if \"stat\" fails.  Typically used as follows:\n\nmy ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,\n$atime,$mtime,$ctime,$blksize,$blocks)\n= stat($filename);\n\nNot all fields are supported on all filesystem types.  Here are the meanings of the\nfields:\n\n0 dev      device number of filesystem\n1 ino      inode number\n2 mode     file mode  (type and permissions)\n3 nlink    number of (hard) links to the file\n4 uid      numeric user ID of file's owner\n5 gid      numeric group ID of file's owner\n6 rdev     the device identifier (special files only)\n7 size     total size of file, in bytes\n8 atime    last access time in seconds since the epoch\n9 mtime    last modify time in seconds since the epoch\n10 ctime    inode change time in seconds since the epoch (*)\n11 blksize  preferred I/O size in bytes for interacting with the\nfile (may vary from file to file)\n12 blocks   actual number of system-specific blocks allocated\non disk (often, but not always, 512 bytes each)\n\n(The epoch was at 00:00 January 1, 1970 GMT.)\n\n(*) Not all fields are supported on all filesystem types.  Notably, the ctime field is\nnon-portable.  In particular, you cannot expect it to be a \"creation time\"; see \"Files\nand Filesystems\" in perlport for details.\n\nIf \"stat\" is passed the special filehandle consisting of an underline, no stat is done,\nbut the current contents of the stat structure from the last \"stat\", \"lstat\", or filetest\nare returned.  Example:\n\nif (-x $file && (($d) = stat()) && $d < 0) {\nprint \"$file is executable NFS file\\n\";\n}\n\n(This works on machines only for which the device number is negative under NFS.)\n\nOn some platforms inode numbers are of a type larger than perl knows how to handle as\ninteger numerical values.  If necessary, an inode number will be returned as a decimal\nstring in order to preserve the entire value.  If used in a numeric context, this will be\nconverted to a floating-point numerical value, with rounding, a fate that is best\navoided.  Therefore, you should prefer to compare inode numbers using \"eq\" rather than\n\"==\".  \"eq\" will work fine on inode numbers that are represented numerically, as well as\nthose represented as strings.\n\nBecause the mode contains both the file type and its permissions, you should mask off the\nfile type portion and (s)printf using a \"%o\" if you want to see the real permissions.\n\nmy $mode = (stat($filename))[2];\nprintf \"Permissions are %04o\\n\", $mode & 07777;\n\nIn scalar context, \"stat\" returns a boolean value indicating success or failure, and, if\nsuccessful, sets the information associated with the special filehandle \"\".\n\nThe File::stat module provides a convenient, by-name access mechanism:\n\nuse File::stat;\nmy $sb = stat($filename);\nprintf \"File is %s, size is %s, perm %04o, mtime %s\\n\",\n$filename, $sb->size, $sb->mode & 07777,\nscalar localtime $sb->mtime;\n\nYou can import symbolic mode constants (\"SIF*\") and functions (\"SIS*\") from the Fcntl\nmodule:\n\nuse Fcntl ':mode';\n\nmy $mode = (stat($filename))[2];\n\nmy $userrwx      = ($mode & SIRWXU) >> 6;\nmy $groupread    = ($mode & SIRGRP) >> 3;\nmy $otherexecute =  $mode & SIXOTH;\n\nprintf \"Permissions are %04o\\n\", SIMODE($mode), \"\\n\";\n\nmy $issetuid     =  $mode & SISUID;\nmy $isdirectory  =  SISDIR($mode);\n\nYou could write the last two using the \"-u\" and \"-d\" operators.  Commonly available\n\"SIF*\" constants are:\n\n# Permissions: read, write, execute, for user, group, others.\n\nSIRWXU SIRUSR SIWUSR SIXUSR\nSIRWXG SIRGRP SIWGRP SIXGRP\nSIRWXO SIROTH SIWOTH SIXOTH\n\n# Setuid/Setgid/Stickiness/SaveText.\n# Note that the exact meaning of these is system-dependent.\n\nSISUID SISGID SISVTX SISTXT\n\n# File types.  Not all are necessarily available on\n# your system.\n\nSIFREG SIFDIR SIFLNK SIFBLK SIFCHR\nSIFIFO SIFSOCK SIFWHT SENFMT\n\n# The following are compatibility aliases for SIRUSR,\n# SIWUSR, and SIXUSR.\n\nSIREAD SIWRITE SIEXEC\n\nand the \"SIF*\" functions are\n\nSIMODE($mode)    the part of $mode containing the permission\nbits and the setuid/setgid/sticky bits\n\nSIFMT($mode)     the part of $mode containing the file type\nwhich can be bit-anded with (for example)\nSIFREG or with the following functions\n\n# The operators -f, -d, -l, -b, -c, -p, and -S.\n\nSISREG($mode) SISDIR($mode) SISLNK($mode)\nSISBLK($mode) SISCHR($mode) SISFIFO($mode) SISSOCK($mode)\n\n# No direct -X operator counterpart, but for the first one\n# the -g operator is often equivalent.  The ENFMT stands for\n# record flocking enforcement, a platform-dependent feature.\n\nSISENFMT($mode) SISWHT($mode)\n\nSee your native chmod(2) and stat(2) documentation for more details about the \"S*\"\nconstants.  To get status info for a symbolic link instead of the target file behind the\nlink, use the \"lstat\" function.\n\nPortability issues: \"stat\" in perlport.\n\nstate VARLIST\nstate TYPE VARLIST\nstate VARLIST : ATTRS\nstate TYPE VARLIST : ATTRS\n\"state\" declares a lexically scoped variable, just like \"my\".  However, those variables\nwill never be reinitialized, contrary to lexical variables that are reinitialized each\ntime their enclosing block is entered.  See \"Persistent Private Variables\" in perlsub for\ndetails.\n\nIf more than one variable is listed, the list must be placed in parentheses.  With a\nparenthesised list, \"undef\" can be used as a dummy placeholder.  However, since\ninitialization of state variables in such lists is currently not possible this would\nserve no purpose.\n\nRedeclaring a variable in the same scope or statement will \"shadow\" the previous\ndeclaration, creating a new instance and preventing access to the previous one. This is\nusually undesired and, if warnings are enabled, will result in a warning in the \"shadow\"\ncategory.\n\n\"state\" is available only if the \"state\" feature is enabled or if it is prefixed with\n\"CORE::\".  The \"state\" feature is enabled automatically with a \"use v5.10\" (or higher)\ndeclaration in the current scope.\n\nstudy SCALAR\nstudy\nAt this time, \"study\" does nothing. This may change in the future.\n\nPrior to Perl version 5.16, it would create an inverted index of all characters that\noccurred in the given SCALAR (or $ if unspecified). When matching a pattern, the rarest\ncharacter from the pattern would be looked up in this index. Rarity was based on some\nstatic frequency tables constructed from some C programs and English text.\n\nsub NAME BLOCK\nsub NAME (PROTO) BLOCK\nsub NAME : ATTRS BLOCK\nsub NAME (PROTO) : ATTRS BLOCK\nThis is subroutine definition, not a real function per se.  Without a BLOCK it's just a\nforward declaration.  Without a NAME, it's an anonymous function declaration, so does\nreturn a value: the CODE ref of the closure just created.\n\nSee perlsub and perlref for details about subroutines and references; see attributes and\nAttribute::Handlers for more information about attributes.\n\nSUB\nA special token that returns a reference to the current subroutine, or \"undef\" outside of\na subroutine.\n\nThe behaviour of \"SUB\" within a regex code block (such as \"/(?{...})/\") is subject to\nchange.\n\nThis token is only available under \"use v5.16\" or the \"currentsub\" feature.  See\nfeature.\n\nsubstr EXPR,OFFSET,LENGTH,REPLACEMENT\nsubstr EXPR,OFFSET,LENGTH\nsubstr EXPR,OFFSET\nExtracts a substring out of EXPR and returns it.  First character is at offset zero.  If\nOFFSET is negative, starts that far back from the end of the string.  If LENGTH is\nomitted, returns everything through the end of the string.  If LENGTH is negative, leaves\nthat many characters off the end of the string.\n\nmy $s = \"The black cat climbed the green tree\";\nmy $color  = substr $s, 4, 5;      # black\nmy $middle = substr $s, 4, -11;    # black cat climbed the\nmy $end    = substr $s, 14;        # climbed the green tree\nmy $tail   = substr $s, -4;        # tree\nmy $z      = substr $s, -4, 2;     # tr\n\nYou can use the \"substr\" function as an lvalue, in which case EXPR must itself be an\nlvalue.  If you assign something shorter than LENGTH, the string will shrink, and if you\nassign something longer than LENGTH, the string will grow to accommodate it.  To keep the\nstring the same length, you may need to pad or chop your value using \"sprintf\".\n\nIf OFFSET and LENGTH specify a substring that is partly outside the string, only the part\nwithin the string is returned.  If the substring is beyond either end of the string,\n\"substr\" returns the undefined value and produces a warning.  When used as an lvalue,\nspecifying a substring that is entirely outside the string raises an exception.  Here's\nan example showing the behavior for boundary cases:\n\nmy $name = 'fred';\nsubstr($name, 4) = 'dy';         # $name is now 'freddy'\nmy $null = substr $name, 6, 2;   # returns \"\" (no warning)\nmy $oops = substr $name, 7;      # returns undef, with warning\nsubstr($name, 7) = 'gap';        # raises an exception\n\nAn alternative to using \"substr\" as an lvalue is to specify the replacement string as the\n4th argument.  This allows you to replace parts of the EXPR and return what was there\nbefore in one operation, just as you can with \"splice\".\n\nmy $s = \"The black cat climbed the green tree\";\nmy $z = substr $s, 14, 7, \"jumped from\";    # climbed\n# $s is now \"The black cat jumped from the green tree\"\n\nNote that the lvalue returned by the three-argument version of \"substr\" acts as a 'magic\nbullet'; each time it is assigned to, it remembers which part of the original string is\nbeing modified; for example:\n\nmy $x = '1234';\nfor (substr($x,1,2)) {\n$ = 'a';   print $x,\"\\n\";    # prints 1a4\n$ = 'xyz'; print $x,\"\\n\";    # prints 1xyz4\n$x = '56789';\n$ = 'pq';  print $x,\"\\n\";    # prints 5pq9\n}\n\nWith negative offsets, it remembers its position from the end of the string when the\ntarget string is modified:\n\nmy $x = '1234';\nfor (substr($x, -3, 2)) {\n$ = 'a';   print $x,\"\\n\";    # prints 1a4, as above\n$x = 'abcdefg';\nprint $,\"\\n\";                # prints f\n}\n\nPrior to Perl version 5.10, the result of using an lvalue multiple times was unspecified.\nPrior to 5.16, the result with negative offsets was unspecified.\n\nsymlink OLDFILE,NEWFILE\nCreates a new filename symbolically linked to the old filename.  Returns 1 for success, 0\notherwise.  On systems that don't support symbolic links, raises an exception.  To check\nfor that, use eval:\n\nmy $symlinkexists = eval { symlink(\"\",\"\"); 1 };\n\nPortability issues: \"symlink\" in perlport.\n\nsyscall NUMBER, LIST\nCalls the system call specified as the first element of the list, passing the remaining\nelements as arguments to the system call.  If unimplemented, raises an exception.  The\narguments are interpreted as follows: if a given argument is numeric, the argument is\npassed as an int.  If not, the pointer to the string value is passed.  You are\nresponsible to make sure a string is pre-extended long enough to receive any result that\nmight be written into a string.  You can't use a string literal (or other read-only\nstring) as an argument to \"syscall\" because Perl has to assume that any string pointer\nmight be written through.  If your integer arguments are not literals and have never been\ninterpreted in a numeric context, you may need to add 0 to them to force them to look\nlike numbers.  This emulates the \"syswrite\" function (or vice versa):\n\nrequire 'syscall.ph';        # may need to run h2ph\nmy $s = \"hi there\\n\";\nsyscall(SYSwrite(), fileno(STDOUT), $s, length $s);\n\nNote that Perl supports passing of up to only 14 arguments to your syscall, which in\npractice should (usually) suffice.\n\nSyscall returns whatever value returned by the system call it calls.  If the system call\nfails, \"syscall\" returns \"-1\" and sets $! (errno).  Note that some system calls can\nlegitimately return \"-1\".  The proper way to handle such calls is to assign \"$! = 0\"\nbefore the call, then check the value of $! if \"syscall\" returns \"-1\".\n\nThere's a problem with \"syscall(SYSpipe())\": it returns the file number of the read end\nof the pipe it creates, but there is no way to retrieve the file number of the other end.\nYou can avoid this problem by using \"pipe\" instead.\n\nPortability issues: \"syscall\" in perlport.\n\nsysopen FILEHANDLE,FILENAME,MODE\nsysopen FILEHANDLE,FILENAME,MODE,PERMS\nOpens the file whose filename is given by FILENAME, and associates it with FILEHANDLE.\nIf FILEHANDLE is an expression, its value is used as the real filehandle wanted; an\nundefined scalar will be suitably autovivified.  This function calls the underlying\noperating system's open(2) function with the parameters FILENAME, MODE, and PERMS.\n\nReturns true on success and \"undef\" otherwise.\n\nPerlIO layers will be applied to the handle the same way they would in an \"open\" call\nthat does not specify layers. That is, the current value of \"${^OPEN}\" as set by the open\npragma in a lexical scope, or the \"-C\" commandline option or \"PERLUNICODE\" environment\nvariable in the main program scope, falling back to the platform defaults as described in\n\"Defaults and how to override them\" in PerlIO. If you want to remove any layers that may\ntransform the byte stream, use \"binmode\" after opening it.\n\nThe possible values and flag bits of the MODE parameter are system-dependent; they are\navailable via the standard module \"Fcntl\".  See the documentation of your operating\nsystem's open(2) syscall to see which values and flag bits are available.  You may\ncombine several flags using the \"|\"-operator.\n\nSome of the most common values are \"ORDONLY\" for opening the file in read-only mode,\n\"OWRONLY\" for opening the file in write-only mode, and \"ORDWR\" for opening the file in\nread-write mode.\n\nFor historical reasons, some values work on almost every system supported by Perl: 0\nmeans read-only, 1 means write-only, and 2 means read/write.  We know that these values\ndo not work under OS/390 and on the Macintosh; you probably don't want to use them in new\ncode.\n\nIf the file named by FILENAME does not exist and the \"open\" call creates it (typically\nbecause MODE includes the \"OCREAT\" flag), then the value of PERMS specifies the\npermissions of the newly created file.  If you omit the PERMS argument to \"sysopen\", Perl\nuses the octal value 0666.  These permission values need to be in octal, and are modified\nby your process's current \"umask\".\n\nIn many systems the \"OEXCL\" flag is available for opening files in exclusive mode.  This\nis not locking: exclusiveness means here that if the file already exists, \"sysopen\"\nfails.  \"OEXCL\" may not work on network filesystems, and has no effect unless the\n\"OCREAT\" flag is set as well.  Setting \"OCREAT|OEXCL\" prevents the file from being\nopened if it is a symbolic link.  It does not protect against symbolic links in the\nfile's path.\n\nSometimes you may want to truncate an already-existing file.  This can be done using the\n\"OTRUNC\" flag.  The behavior of \"OTRUNC\" with \"ORDONLY\" is undefined.\n\nYou should seldom if ever use 0644 as argument to \"sysopen\", because that takes away the\nuser's option to have a more permissive umask.  Better to omit it.  See \"umask\" for more\non this.\n\nThis function has no direct relation to the usage of \"sysread\", \"syswrite\", or \"sysseek\".\nA handle opened with this function can be used with buffered IO just as one opened with\n\"open\" can be used with unbuffered IO.\n\nNote that under Perls older than 5.8.0, \"sysopen\" depends on the fdopen(3) C library\nfunction.  On many Unix systems, fdopen(3) is known to fail when file descriptors exceed\na certain value, typically 255.  If you need more file descriptors than that, consider\nusing the \"POSIX::open\" function.  For Perls 5.8.0 and later, PerlIO is (most often) the\ndefault.\n\nSee perlopentut for a kinder, gentler explanation of opening files.\n\nPortability issues: \"sysopen\" in perlport.\n\nsysread FILEHANDLE,SCALAR,LENGTH,OFFSET\nsysread FILEHANDLE,SCALAR,LENGTH\nAttempts to read LENGTH bytes of data into variable SCALAR from the specified FILEHANDLE,\nusing read(2).  It bypasses any PerlIO layers including buffered IO (but is affected by\nthe presence of the \":utf8\" layer as described later), so mixing this with other kinds of\nreads, \"print\", \"write\", \"seek\", \"tell\", or \"eof\" can cause confusion because the\n\":perlio\" or \":crlf\" layers usually buffer data.  Returns the number of bytes actually\nread, 0 at end of file, or undef if there was an error (in the latter case $! is also\nset).  SCALAR will be grown or shrunk so that the last byte actually read is the last\nbyte of the scalar after the read.\n\nAn OFFSET may be specified to place the read data at some place in the string other than\nthe beginning.  A negative OFFSET specifies placement at that many characters counting\nbackwards from the end of the string.  A positive OFFSET greater than the length of\nSCALAR results in the string being padded to the required size with \"\\0\" bytes before the\nresult of the read is appended.\n\nThere is no syseof() function, which is ok, since \"eof\" doesn't work well on device files\n(like ttys) anyway.  Use \"sysread\" and check for a return value of 0 to decide whether\nyou're done.\n\nNote that if the filehandle has been marked as \":utf8\", \"sysread\" will throw an\nexception.  The \":encoding(...)\" layer implicitly introduces the \":utf8\" layer.  See\n\"binmode\", \"open\", and the open pragma.\n\nsysseek FILEHANDLE,POSITION,WHENCE\nSets FILEHANDLE's system position in bytes using lseek(2).  FILEHANDLE may be an\nexpression whose value gives the name of the filehandle.  The values for WHENCE are 0 to\nset the new position to POSITION; 1 to set it to the current position plus POSITION; and\n2 to set it to EOF plus POSITION, typically negative.\n\nNote the emphasis on bytes: even if the filehandle has been set to operate on characters\n(for example using the \":encoding(UTF-8)\" I/O layer), the \"seek\", \"tell\", and \"sysseek\"\nfamily of functions use byte offsets, not character offsets, because seeking to a\ncharacter offset would be very slow in a UTF-8 file.\n\n\"sysseek\" bypasses normal buffered IO, so mixing it with reads other than \"sysread\" (for\nexample \"readline\" or \"read\"), \"print\", \"write\", \"seek\", \"tell\", or \"eof\" may cause\nconfusion.\n\nFor WHENCE, you may also use the constants \"SEEKSET\", \"SEEKCUR\", and \"SEEKEND\" (start\nof the file, current position, end of the file) from the Fcntl module.  Use of the\nconstants is also more portable than relying on 0, 1, and 2.  For example to define a\n\"systell\" function:\n\nuse Fcntl 'SEEKCUR';\nsub systell { sysseek($[0], 0, SEEKCUR) }\n\nReturns the new position, or the undefined value on failure.  A position of zero is\nreturned as the string \"0 but true\"; thus \"sysseek\" returns true on success and false on\nfailure, yet you can still easily determine the new position.\n\nsystem LIST\nsystem PROGRAM LIST\nDoes exactly the same thing as \"exec\", except that a fork is done first and the parent\nprocess waits for the child process to exit.  Note that argument processing varies\ndepending on the number of arguments.  If there is more than one argument in LIST, or if\nLIST is an array with more than one value, starts the program given by the first element\nof the list with arguments given by the rest of the list.  If there is only one scalar\nargument, the argument is checked for shell metacharacters, and if there are any, the\nentire argument is passed to the system's command shell for parsing (this is \"/bin/sh -c\"\non Unix platforms, but varies on other platforms).  If there are no shell metacharacters\nin the argument, it is split into words and passed directly to \"execvp\", which is more\nefficient.  On Windows, only the \"system PROGRAM LIST\" syntax will reliably avoid using\nthe shell; \"system LIST\", even with more than one element, will fall back to the shell if\nthe first spawn fails.\n\nPerl will attempt to flush all files opened for output before any operation that may do a\nfork, but this may not be supported on some platforms (see perlport).  To be safe, you\nmay need to set $| ($AUTOFLUSH in English) or call the \"autoflush\" method of \"IO::Handle\"\non any open handles.\n\nThe return value is the exit status of the program as returned by the \"wait\" call.  To\nget the actual exit value, shift right by eight (see below).  See also \"exec\".  This is\nnot what you want to use to capture the output from a command; for that you should use\nmerely backticks or \"qx//\", as described in \"`STRING`\" in perlop.  Return value of -1\nindicates a failure to start the program or an error of the wait(2) system call (inspect\n$! for the reason).\n\nIf you'd like to make \"system\" (and many other bits of Perl) die on error, have a look at\nthe autodie pragma.\n\nLike \"exec\", \"system\" allows you to lie to a program about its name if you use the\n\"system PROGRAM LIST\" syntax.  Again, see \"exec\".\n\nSince \"SIGINT\" and \"SIGQUIT\" are ignored during the execution of \"system\", if you expect\nyour program to terminate on receipt of these signals you will need to arrange to do so\nyourself based on the return value.\n\nmy @args = (\"command\", \"arg1\", \"arg2\");\nsystem(@args) == 0\nor die \"system @args failed: $?\";\n\nIf you'd like to manually inspect \"system\"'s failure, you can check all possible failure\nmodes by inspecting $? like this:\n\nif ($? == -1) {\nprint \"failed to execute: $!\\n\";\n}\nelsif ($? & 127) {\nprintf \"child died with signal %d, %s coredump\\n\",\n($? & 127),  ($? & 128) ? 'with' : 'without';\n}\nelse {\nprintf \"child exited with value %d\\n\", $? >> 8;\n}\n\nAlternatively, you may inspect the value of \"${^CHILDERRORNATIVE}\" with the \"W*()\"\ncalls from the POSIX module.\n\nWhen \"system\"'s arguments are executed indirectly by the shell, results and return codes\nare subject to its quirks.  See \"`STRING`\" in perlop and \"exec\" for details.\n\nSince \"system\" does a \"fork\" and \"wait\" it may affect a \"SIGCHLD\" handler.  See perlipc\nfor details.\n\nPortability issues: \"system\" in perlport.\n\nsyswrite FILEHANDLE,SCALAR,LENGTH,OFFSET\nsyswrite FILEHANDLE,SCALAR,LENGTH\nsyswrite FILEHANDLE,SCALAR\nAttempts to write LENGTH bytes of data from variable SCALAR to the specified FILEHANDLE,\nusing write(2).  If LENGTH is not specified, writes whole SCALAR.  It bypasses any PerlIO\nlayers including buffered IO (but is affected by the presence of the \":utf8\" layer as\ndescribed later), so mixing this with reads (other than \"sysread)\"), \"print\", \"write\",\n\"seek\", \"tell\", or \"eof\" may cause confusion because the \":perlio\" and \":crlf\" layers\nusually buffer data.  Returns the number of bytes actually written, or \"undef\" if there\nwas an error (in this case the errno variable $! is also set).  If the LENGTH is greater\nthan the data available in the SCALAR after the OFFSET, only as much data as is available\nwill be written.\n\nAn OFFSET may be specified to write the data from some part of the string other than the\nbeginning.  A negative OFFSET specifies writing that many characters counting backwards\nfrom the end of the string.  If SCALAR is of length zero, you can only use an OFFSET of\n0.\n\nWARNING: If the filehandle is marked \":utf8\", \"syswrite\" will raise an exception.  The\n\":encoding(...)\" layer implicitly introduces the \":utf8\" layer.  Alternately, if the\nhandle is not marked with an encoding but you attempt to write characters with code\npoints over 255, raises an exception.  See \"binmode\", \"open\", and the open pragma.\n\ntell FILEHANDLE\ntell\nReturns the current position in bytes for FILEHANDLE, or -1 on error.  FILEHANDLE may be\nan expression whose value gives the name of the actual filehandle.  If FILEHANDLE is\nomitted, assumes the file last read.\n\nNote the emphasis on bytes: even if the filehandle has been set to operate on characters\n(for example using the \":encoding(UTF-8)\" I/O layer), the \"seek\", \"tell\", and \"sysseek\"\nfamily of functions use byte offsets, not character offsets, because seeking to a\ncharacter offset would be very slow in a UTF-8 file.\n\nThe return value of \"tell\" for the standard streams like the STDIN depends on the\noperating system: it may return -1 or something else.  \"tell\" on pipes, fifos, and\nsockets usually returns -1.\n\nThere is no \"systell\" function.  Use \"sysseek($fh, 0, 1)\" for that.\n\nDo not use \"tell\" (or other buffered I/O operations) on a filehandle that has been\nmanipulated by \"sysread\", \"syswrite\", or \"sysseek\".  Those functions ignore the\nbuffering, while \"tell\" does not.\n\ntelldir DIRHANDLE\nReturns the current position of the \"readdir\" routines on DIRHANDLE.  Value may be given\nto \"seekdir\" to access a particular location in a directory.  \"telldir\" has the same\ncaveats about possible directory compaction as the corresponding system library routine.\n\ntie VARIABLE,CLASSNAME,LIST\nThis function binds a variable to a package class that will provide the implementation\nfor the variable.  VARIABLE is the name of the variable to be enchanted.  CLASSNAME is\nthe name of a class implementing objects of correct type.  Any additional arguments are\npassed to the appropriate constructor method of the class (meaning \"TIESCALAR\",\n\"TIEHANDLE\", \"TIEARRAY\", or \"TIEHASH\").  Typically these are arguments such as might be\npassed to the dbmopen(3) function of C.  The object returned by the constructor is also\nreturned by the \"tie\" function, which would be useful if you want to access other methods\nin CLASSNAME.\n\nNote that functions such as \"keys\" and \"values\" may return huge lists when used on large\nobjects, like DBM files.  You may prefer to use the \"each\" function to iterate over such.\nExample:\n\n# print out history file offsets\nuse NDBMFile;\ntie(my %HIST, 'NDBMFile', '/usr/lib/news/history', 1, 0);\nwhile (my ($key,$val) = each %HIST) {\nprint $key, ' = ', unpack('L', $val), \"\\n\";\n}\n\nA class implementing a hash should have the following methods:\n\nTIEHASH classname, LIST\nFETCH this, key\nSTORE this, key, value\nDELETE this, key\nCLEAR this\nEXISTS this, key\nFIRSTKEY this\nNEXTKEY this, lastkey\nSCALAR this\nDESTROY this\nUNTIE this\n\nA class implementing an ordinary array should have the following methods:\n\nTIEARRAY classname, LIST\nFETCH this, key\nSTORE this, key, value\nFETCHSIZE this\nSTORESIZE this, count\nCLEAR this\nPUSH this, LIST\nPOP this\nSHIFT this\nUNSHIFT this, LIST\nSPLICE this, offset, length, LIST\nEXTEND this, count\nDELETE this, key\nEXISTS this, key\nDESTROY this\nUNTIE this\n\nA class implementing a filehandle should have the following methods:\n\nTIEHANDLE classname, LIST\nREAD this, scalar, length, offset\nREADLINE this\nGETC this\nWRITE this, scalar, length, offset\nPRINT this, LIST\nPRINTF this, format, LIST\nBINMODE this\nEOF this\nFILENO this\nSEEK this, position, whence\nTELL this\nOPEN this, mode, LIST\nCLOSE this\nDESTROY this\nUNTIE this\n\nA class implementing a scalar should have the following methods:\n\nTIESCALAR classname, LIST\nFETCH this,\nSTORE this, value\nDESTROY this\nUNTIE this\n\nNot all methods indicated above need be implemented.  See perltie, Tie::Hash, Tie::Array,\nTie::Scalar, and Tie::Handle.\n\nUnlike \"dbmopen\", the \"tie\" function will not \"use\" or \"require\" a module for you; you\nneed to do that explicitly yourself.  See DBFile or the Config module for interesting\n\"tie\" implementations.\n\nFor further details see perltie, \"tied\".\n\ntied VARIABLE\nReturns a reference to the object underlying VARIABLE (the same value that was originally\nreturned by the \"tie\" call that bound the variable to a package.)  Returns the undefined\nvalue if VARIABLE isn't tied to a package.\n\ntime\nReturns the number of non-leap seconds since whatever time the system considers to be the\nepoch, suitable for feeding to \"gmtime\" and \"localtime\".  On most systems the epoch is\n00:00:00 UTC, January 1, 1970; a prominent exception being Mac OS Classic which uses\n00:00:00, January 1, 1904 in the current local time zone for its epoch.\n\nFor measuring time in better granularity than one second, use the Time::HiRes module from\nPerl 5.8 onwards (or from CPAN before then), or, if you have gettimeofday(2), you may be\nable to use the \"syscall\" interface of Perl.  See perlfaq8 for details.\n\nFor date and time processing look at the many related modules on CPAN.  For a\ncomprehensive date and time representation look at the DateTime module.\n\ntimes\nReturns a four-element list giving the user and system times in seconds for this process\nand any exited children of this process.\n\nmy ($user,$system,$cuser,$csystem) = times;\n\nIn scalar context, \"times\" returns $user.\n\nChildren's times are only included for terminated children.\n\nPortability issues: \"times\" in perlport.\n\ntr///\nThe transliteration operator.  Same as \"y///\".  See \"Quote-Like Operators\" in perlop.\n\ntruncate FILEHANDLE,LENGTH\ntruncate EXPR,LENGTH\nTruncates the file opened on FILEHANDLE, or named by EXPR, to the specified length.\nRaises an exception if truncate isn't implemented on your system.  Returns true if\nsuccessful, \"undef\" on error.\n\nThe behavior is undefined if LENGTH is greater than the length of the file.\n\nThe position in the file of FILEHANDLE is left unchanged.  You may want to call seek\nbefore writing to the file.\n\nPortability issues: \"truncate\" in perlport.\n\nuc EXPR\nuc  Returns an uppercased version of EXPR.  This is the internal function implementing the\n\"\\U\" escape in double-quoted strings.  It does not attempt to do titlecase mapping on\ninitial letters.  See \"ucfirst\" for that.\n\nIf EXPR is omitted, uses $.\n\nThis function behaves the same way under various pragmas, such as in a locale, as \"lc\"\ndoes.\n\nucfirst EXPR\nucfirst\nReturns the value of EXPR with the first character in uppercase (titlecase in Unicode).\nThis is the internal function implementing the \"\\u\" escape in double-quoted strings.\n\nIf EXPR is omitted, uses $.\n\nThis function behaves the same way under various pragmas, such as in a locale, as \"lc\"\ndoes.\n\numask EXPR\numask\nSets the umask for the process to EXPR and returns the previous value.  If EXPR is\nomitted, merely returns the current umask.\n\nThe Unix permission \"rwxr-x---\" is represented as three sets of three bits, or three\noctal digits: 0750 (the leading 0 indicates octal and isn't one of the digits).  The\n\"umask\" value is such a number representing disabled permissions bits.  The permission\n(or \"mode\") values you pass \"mkdir\" or \"sysopen\" are modified by your umask, so even if\nyou tell \"sysopen\" to create a file with permissions 0777, if your umask is 0022, then\nthe file will actually be created with permissions 0755.  If your \"umask\" were 0027\n(group can't write; others can't read, write, or execute), then passing \"sysopen\" 0666\nwould create a file with mode 0640 (because \"0666 &~ 027\" is 0640).\n\nHere's some advice: supply a creation mode of 0666 for regular files (in \"sysopen\") and\none of 0777 for directories (in \"mkdir\") and executable files.  This gives users the\nfreedom of choice: if they want protected files, they might choose process umasks of 022,\n027, or even the particularly antisocial mask of 077.  Programs should rarely if ever\nmake policy decisions better left to the user.  The exception to this is when writing\nfiles that should be kept private: mail files, web browser cookies, .rhosts files, and so\non.\n\nIf umask(2) is not implemented on your system and you are trying to restrict access for\nyourself (i.e., \"(EXPR & 0700) > 0\"), raises an exception.  If umask(2) is not\nimplemented and you are not trying to restrict access for yourself, returns \"undef\".\n\nRemember that a umask is a number, usually given in octal; it is not a string of octal\ndigits.  See also \"oct\", if all you have is a string.\n\nPortability issues: \"umask\" in perlport.\n\nundef EXPR\nundef\nUndefines the value of EXPR, which must be an lvalue.  Use only on a scalar value, an\narray (using \"@\"), a hash (using \"%\"), a subroutine (using \"&\"), or a typeglob (using\n\"*\").  Saying \"undef $hash{$key}\" will probably not do what you expect on most predefined\nvariables or DBM list values, so don't do that; see \"delete\".  Always returns the\nundefined value.  You can omit the EXPR, in which case nothing is undefined, but you\nstill get an undefined value that you could, for instance, return from a subroutine,\nassign to a variable, or pass as a parameter.  Examples:\n\nundef $foo;\nundef $bar{'blurfl'};      # Compare to: delete $bar{'blurfl'};\nundef @ary;\nundef %hash;\nundef &mysub;\nundef *xyz;       # destroys $xyz, @xyz, %xyz, &xyz, etc.\nreturn (wantarray ? (undef, $errmsg) : undef) if $theyblewit;\nselect undef, undef, undef, 0.25;\nmy ($x, $y, undef, $z) = foo();    # Ignore third value returned\n\nNote that this is a unary operator, not a list operator.\n\nunlink LIST\nunlink\nDeletes a list of files.  On success, it returns the number of files it successfully\ndeleted.  On failure, it returns false and sets $! (errno):\n\nmy $unlinked = unlink 'a', 'b', 'c';\nunlink @goners;\nunlink glob \"*.bak\";\n\nOn error, \"unlink\" will not tell you which files it could not remove.  If you want to\nknow which files you could not remove, try them one at a time:\n\nforeach my $file ( @goners ) {\nunlink $file or warn \"Could not unlink $file: $!\";\n}\n\nNote: \"unlink\" will not attempt to delete directories unless you are superuser and the -U\nflag is supplied to Perl.  Even if these conditions are met, be warned that unlinking a\ndirectory can inflict damage on your filesystem.  Finally, using \"unlink\" on directories\nis not supported on many operating systems.  Use \"rmdir\" instead.\n\nIf LIST is omitted, \"unlink\" uses $.\n\nunpack TEMPLATE,EXPR\nunpack TEMPLATE\n\"unpack\" does the reverse of \"pack\": it takes a string and expands it out into a list of\nvalues.  (In scalar context, it returns merely the first value produced.)\n\nIf EXPR is omitted, unpacks the $ string.  See perlpacktut for an introduction to this\nfunction.\n\nThe string is broken into chunks described by the TEMPLATE.  Each chunk is converted\nseparately to a value.  Typically, either the string is a result of \"pack\", or the\ncharacters of the string represent a C structure of some kind.\n\nThe TEMPLATE has the same format as in the \"pack\" function.  Here's a subroutine that\ndoes substring:\n\nsub substr {\nmy ($what, $where, $howmuch) = @;\nunpack(\"x$where a$howmuch\", $what);\n}\n\nand then there's\n\nsub ordinal { unpack(\"W\",$[0]); } # same as ord()\n\nIn addition to fields allowed in \"pack\", you may prefix a field with a %<number> to\nindicate that you want a <number>-bit checksum of the items instead of the items\nthemselves.  Default is a 16-bit checksum.  The checksum is calculated by summing numeric\nvalues of expanded values (for string fields the sum of \"ord($char)\" is taken; for bit\nfields the sum of zeroes and ones).\n\nFor example, the following computes the same number as the System V sum program:\n\nmy $checksum = do {\nlocal $/;  # slurp!\nunpack(\"%32W*\", readline) % 65535;\n};\n\nThe following efficiently counts the number of set bits in a bit vector:\n\nmy $setbits = unpack(\"%32b*\", $selectmask);\n\nThe \"p\" and \"P\" formats should be used with care.  Since Perl has no way of checking\nwhether the value passed to \"unpack\" corresponds to a valid memory location, passing a\npointer value that's not known to be valid is likely to have disastrous consequences.\n\nIf there are more pack codes or if the repeat count of a field or a group is larger than\nwhat the remainder of the input string allows, the result is not well defined: the repeat\ncount may be decreased, or \"unpack\" may produce empty strings or zeros, or it may raise\nan exception.  If the input string is longer than one described by the TEMPLATE, the\nremainder of that input string is ignored.\n\nSee \"pack\" for more examples and notes.\n\nunshift ARRAY,LIST\nDoes the opposite of a \"shift\".  Or the opposite of a \"push\", depending on how you look\nat it.  Prepends list to the front of the array and returns the new number of elements in\nthe array.\n\nunshift(@ARGV, '-e') unless $ARGV[0] =~ /^-/;\n\nNote the LIST is prepended whole, not one element at a time, so the prepended elements\nstay in the same order.  Use \"reverse\" to do the reverse.\n\nStarting with Perl 5.14, an experimental feature allowed \"unshift\" to take a scalar\nexpression. This experiment has been deemed unsuccessful, and was removed as of Perl\n5.24.\n\nuntie VARIABLE\nBreaks the binding between a variable and a package.  (See tie.)  Has no effect if the\nvariable is not tied.\n\nuse Module VERSION LIST\nuse Module VERSION\nuse Module LIST\nuse Module\nuse VERSION\nImports some semantics into the current package from the named module, generally by\naliasing certain subroutine or variable names into your package.  It is exactly\nequivalent to\n\nBEGIN { require Module; Module->import( LIST ); }\n\nexcept that Module must be a bareword.  The importation can be made conditional by using\nthe if module.\n\nIn the \"use VERSION\" form, VERSION may be either a v-string such as v5.24.1, which will\nbe compared to $^V (aka $PERLVERSION), or a numeric argument of the form 5.024001, which\nwill be compared to $].  An exception is raised if VERSION is greater than the version of\nthe current Perl interpreter; Perl will not attempt to parse the rest of the file.\nCompare with \"require\", which can do a similar check at run time.  Symmetrically, \"no\nVERSION\" allows you to specify that you want a version of Perl older than the specified\none.\n\nSpecifying VERSION as a numeric argument of the form 5.024001 should generally be avoided\nas older less readable syntax compared to v5.24.1. Before perl 5.8.0 released in 2002 the\nmore verbose numeric form was the only supported syntax, which is why you might see it in\n\nuse v5.24.1;    # compile time version check\nuse 5.24.1;     # ditto\nuse 5.024001;  # ditto; older syntax compatible with perl 5.6\n\nThis is often useful if you need to check the current Perl version before \"use\"ing\nlibrary modules that won't work with older versions of Perl.  (We try not to do this more\nthan we have to.)\n\n\"use VERSION\" also lexically enables all features available in the requested version as\ndefined by the feature pragma, disabling any features not in the requested version's\nfeature bundle.  See feature.  Similarly, if the specified Perl version is greater than\nor equal to 5.12.0, strictures are enabled lexically as with \"use strict\".  Any explicit\nuse of \"use strict\" or \"no strict\" overrides \"use VERSION\", even if it comes before it.\nLater use of \"use VERSION\" will override all behavior of a previous \"use VERSION\",\npossibly removing the \"strict\" and \"feature\" added by \"use VERSION\".  \"use VERSION\" does\nnot load the feature.pm or strict.pm files.\n\nThe \"BEGIN\" forces the \"require\" and \"import\" to happen at compile time.  The \"require\"\nmakes sure the module is loaded into memory if it hasn't been yet.  The \"import\" is not a\nbuiltin; it's just an ordinary static method call into the \"Module\" package to tell the\nmodule to import the list of features back into the current package.  The module can\nimplement its \"import\" method any way it likes, though most modules just choose to derive\ntheir \"import\" method via inheritance from the \"Exporter\" class that is defined in the\n\"Exporter\" module.  See Exporter.  If no \"import\" method can be found, then the call is\nskipped, even if there is an AUTOLOAD method.\n\nIf you do not want to call the package's \"import\" method (for instance, to stop your\nnamespace from being altered), explicitly supply the empty list:\n\nuse Module ();\n\nThat is exactly equivalent to\n\nBEGIN { require Module }\n\nIf the VERSION argument is present between Module and LIST, then the \"use\" will call the\n\"VERSION\" method in class Module with the given version as an argument:\n\nuse Module 12.34;\n\nis equivalent to:\n\nBEGIN { require Module; Module->VERSION(12.34) }\n\nThe default \"VERSION\" method, inherited from the \"UNIVERSAL\" class, croaks if the given\nversion is larger than the value of the variable $Module::VERSION.\n\nThe VERSION argument cannot be an arbitrary expression.  It only counts as a VERSION\nargument if it is a version number literal, starting with either a digit or \"v\" followed\nby a digit.  Anything that doesn't look like a version literal will be parsed as the\nstart of the LIST.  Nevertheless, many attempts to use an arbitrary expression as a\nVERSION argument will appear to work, because Exporter's \"import\" method handles numeric\narguments specially, performing version checks rather than treating them as things to\nexport.\n\nAgain, there is a distinction between omitting LIST (\"import\" called with no arguments)\nand an explicit empty LIST \"()\" (\"import\" not called).  Note that there is no comma after\nVERSION!\n\nBecause this is a wide-open interface, pragmas (compiler directives) are also implemented\nthis way.  Some of the currently implemented pragmas are:\n\nuse constant;\nuse diagnostics;\nuse integer;\nuse sigtrap  qw(SEGV BUS);\nuse strict   qw(subs vars refs);\nuse subs     qw(afunc blurfl);\nuse warnings qw(all);\nuse sort     qw(stable);\n\nSome of these pseudo-modules import semantics into the current block scope (like \"strict\"\nor \"integer\", unlike ordinary modules, which import symbols into the current package\n(which are effective through the end of the file).\n\nBecause \"use\" takes effect at compile time, it doesn't respect the ordinary flow control\nof the code being compiled.  In particular, putting a \"use\" inside the false branch of a\nconditional doesn't prevent it from being processed.  If a module or pragma only needs to\nbe loaded conditionally, this can be done using the if pragma:\n\nuse if $] < 5.008, \"utf8\";\nuse if WANTWARNINGS, warnings => qw(all);\n\nThere's a corresponding \"no\" declaration that unimports meanings imported by \"use\", i.e.,\nit calls \"Module->unimport(LIST)\" instead of \"import\".  It behaves just as \"import\" does\nwith VERSION, an omitted or empty LIST, or no unimport method being found.\n\nno integer;\nno strict 'refs';\nno warnings;\n\nCare should be taken when using the \"no VERSION\" form of \"no\".  It is only meant to be\nused to assert that the running Perl is of a earlier version than its argument and not to\nundo the feature-enabling side effects of \"use VERSION\".\n\nSee perlmodlib for a list of standard modules and pragmas.  See perlrun for the \"-M\" and\n\"-m\" command-line options to Perl that give \"use\" functionality from the command-line.\n\nutime LIST\nChanges the access and modification times on each file of a list of files.  The first two\nelements of the list must be the NUMERIC access and modification times, in that order.\nReturns the number of files successfully changed.  The inode change time of each file is\nset to the current time.  For example, this code has the same effect as the Unix touch(1)\ncommand when the files already exist and belong to the user running the program:\n\n#!/usr/bin/perl\nmy $atime = my $mtime = time;\nutime $atime, $mtime, @ARGV;\n\nSince Perl 5.8.0, if the first two elements of the list are \"undef\", the utime(2) syscall\nfrom your C library is called with a null second argument.  On most systems, this will\nset the file's access and modification times to the current time (i.e., equivalent to the\nexample above) and will work even on files you don't own provided you have write\npermission:\n\nfor my $file (@ARGV) {\nutime(undef, undef, $file)\n|| warn \"Couldn't touch $file: $!\";\n}\n\nUnder NFS this will use the time of the NFS server, not the time of the local machine.\nIf there is a time synchronization problem, the NFS server and local machine will have\ndifferent times.  The Unix touch(1) command will in fact normally use this form instead\nof the one shown in the first example.\n\nPassing only one of the first two elements as \"undef\" is equivalent to passing a 0 and\nwill not have the effect described when both are \"undef\".  This also triggers an\nuninitialized warning.\n\nOn systems that support futimes(2), you may pass filehandles among the files.  On systems\nthat don't support futimes(2), passing filehandles raises an exception.  Filehandles must\nbe passed as globs or glob references to be recognized; barewords are considered\nfilenames.\n\nPortability issues: \"utime\" in perlport.\n\nvalues HASH\nvalues ARRAY\nIn list context, returns a list consisting of all the values of the named hash.  In Perl\n5.12 or later only, will also return a list of the values of an array; prior to that\nrelease, attempting to use an array argument will produce a syntax error.  In scalar\ncontext, returns the number of values.\n\nHash entries are returned in an apparently random order.  The actual random order is\nspecific to a given hash; the exact same series of operations on two hashes may result in\na different order for each hash.  Any insertion into the hash may change the order, as\nwill any deletion, with the exception that the most recent key returned by \"each\" or\n\"keys\" may be deleted without changing the order.  So long as a given hash is unmodified\nyou may rely on \"keys\", \"values\" and \"each\" to repeatedly return the same order as each\nother.  See \"Algorithmic Complexity Attacks\" in perlsec for details on why hash order is\nrandomized.  Aside from the guarantees provided here the exact details of Perl's hash\nalgorithm and the hash traversal order are subject to change in any release of Perl.\nTied hashes may behave differently to Perl's hashes with respect to changes in order on\ninsertion and deletion of items.\n\nAs a side effect, calling \"values\" resets the HASH or ARRAY's internal iterator (see\n\"each\") before yielding the values.  In particular, calling \"values\" in void context\nresets the iterator with no other overhead.\n\nApart from resetting the iterator, \"values @array\" in list context is the same as plain\n@array.  (We recommend that you use void context \"keys @array\" for this, but reasoned\nthat taking \"values @array\" out would require more documentation than leaving it in.)\n\nNote that the values are not copied, which means modifying them will modify the contents\nof the hash:\n\nfor (values %hash)      { s/foo/bar/g }  # modifies %hash values\nfor (@hash{keys %hash}) { s/foo/bar/g }  # same\n\nStarting with Perl 5.14, an experimental feature allowed \"values\" to take a scalar\nexpression. This experiment has been deemed unsuccessful, and was removed as of Perl\n5.24.\n\nTo avoid confusing would-be users of your code who are running earlier versions of Perl\nwith mysterious syntax errors, put this sort of thing at the top of your file to signal\nthat your code will work only on Perls of a recent vintage:\n\nuse 5.012;  # so keys/values/each work on arrays\n\nSee also \"keys\", \"each\", and \"sort\".\n\nvec EXPR,OFFSET,BITS\nTreats the string in EXPR as a bit vector made up of elements of width BITS and returns\nthe value of the element specified by OFFSET as an unsigned integer.  BITS therefore\nspecifies the number of bits that are reserved for each element in the bit vector.  This\nmust be a power of two from 1 to 32 (or 64, if your platform supports that).\n\nIf BITS is 8, \"elements\" coincide with bytes of the input string.\n\nIf BITS is 16 or more, bytes of the input string are grouped into chunks of size BITS/8,\nand each group is converted to a number as with \"pack\"/\"unpack\" with big-endian formats\n\"n\"/\"N\" (and analogously for BITS==64).  See \"pack\" for details.\n\nIf bits is 4 or less, the string is broken into bytes, then the bits of each byte are\nbroken into 8/BITS groups.  Bits of a byte are numbered in a little-endian-ish way, as in\n0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80.  For example, breaking the single input\nbyte \"chr(0x36)\" into two groups gives a list \"(0x6, 0x3)\"; breaking it into 4 groups\ngives \"(0x2, 0x1, 0x3, 0x0)\".\n\n\"vec\" may also be assigned to, in which case parentheses are needed to give the\nexpression the correct precedence as in\n\nvec($image, $maxx * $x + $y, 8) = 3;\n\nIf the selected element is outside the string, the value 0 is returned.  If an element\noff the end of the string is written to, Perl will first extend the string with\nsufficiently many zero bytes.   It is an error to try to write off the beginning of the\nstring (i.e., negative OFFSET).\n\nIf the string happens to be encoded as UTF-8 internally (and thus has the UTF8 flag set),\n\"vec\" tries to convert it to use a one-byte-per-character internal representation.\nHowever, if the string contains characters with values of 256 or higher, a fatal error\nwill occur.\n\nStrings created with \"vec\" can also be manipulated with the logical operators \"|\", \"&\",\n\"^\", and \"~\".  These operators will assume a bit vector operation is desired when both\noperands are strings.  See \"Bitwise String Operators\" in perlop.\n\nThe following code will build up an ASCII string saying 'PerlPerlPerl'.  The comments\nshow the string after each step.  Note that this code works in the same way on big-endian\nor little-endian machines.\n\nmy $foo = '';\nvec($foo,  0, 32) = 0x5065726C; # 'Perl'\n\n# $foo eq \"Perl\" eq \"\\x50\\x65\\x72\\x6C\", 32 bits\nprint vec($foo, 0, 8);  # prints 80 == 0x50 == ord('P')\n\nvec($foo,  2, 16) = 0x5065; # 'PerlPe'\nvec($foo,  3, 16) = 0x726C; # 'PerlPerl'\nvec($foo,  8,  8) = 0x50;   # 'PerlPerlP'\nvec($foo,  9,  8) = 0x65;   # 'PerlPerlPe'\nvec($foo, 20,  4) = 2;      # 'PerlPerlPe'   . \"\\x02\"\nvec($foo, 21,  4) = 7;      # 'PerlPerlPer'\n# 'r' is \"\\x72\"\nvec($foo, 45,  2) = 3;      # 'PerlPerlPer'  . \"\\x0c\"\nvec($foo, 93,  1) = 1;      # 'PerlPerlPer'  . \"\\x2c\"\nvec($foo, 94,  1) = 1;      # 'PerlPerlPerl'\n# 'l' is \"\\x6c\"\n\nTo transform a bit vector into a string or list of 0's and 1's, use these:\n\nmy $bits = unpack(\"b*\", $vector);\nmy @bits = split(//, unpack(\"b*\", $vector));\n\nIf you know the exact length in bits, it can be used in place of the \"*\".\n\nHere is an example to illustrate how the bits actually fall in place:\n\n#!/usr/bin/perl -wl\n\nprint <<'EOT';\n0         1         2         3\nunpack(\"V\",$) 01234567890123456789012345678901\n------------------------------------------------------------------\nEOT\n\nfor $w (0..3) {\n$width = 2$w;\nfor ($shift=0; $shift < $width; ++$shift) {\nfor ($off=0; $off < 32/$width; ++$off) {\n$str = pack(\"B*\", \"0\"x32);\n$bits = (1<<$shift);\nvec($str, $off, $width) = $bits;\n$res = unpack(\"b*\",$str);\n$val = unpack(\"V\", $str);\nwrite;\n}\n}\n}\n\nformat STDOUT =\nvec($,@#,@#) = @<< == @######### @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n$off, $width, $bits, $val, $res\n.\nEND\n\nRegardless of the machine architecture on which it runs, the example above should print\nthe following table:\n\n0         1         2         3\nunpack(\"V\",$) 01234567890123456789012345678901\n------------------------------------------------------------------\nvec($, 0, 1) = 1   ==          1 10000000000000000000000000000000\nvec($, 1, 1) = 1   ==          2 01000000000000000000000000000000\nvec($, 2, 1) = 1   ==          4 00100000000000000000000000000000\nvec($, 3, 1) = 1   ==          8 00010000000000000000000000000000\nvec($, 4, 1) = 1   ==         16 00001000000000000000000000000000\nvec($, 5, 1) = 1   ==         32 00000100000000000000000000000000\nvec($, 6, 1) = 1   ==         64 00000010000000000000000000000000\nvec($, 7, 1) = 1   ==        128 00000001000000000000000000000000\nvec($, 8, 1) = 1   ==        256 00000000100000000000000000000000\nvec($, 9, 1) = 1   ==        512 00000000010000000000000000000000\nvec($,10, 1) = 1   ==       1024 00000000001000000000000000000000\nvec($,11, 1) = 1   ==       2048 00000000000100000000000000000000\nvec($,12, 1) = 1   ==       4096 00000000000010000000000000000000\nvec($,13, 1) = 1   ==       8192 00000000000001000000000000000000\nvec($,14, 1) = 1   ==      16384 00000000000000100000000000000000\nvec($,15, 1) = 1   ==      32768 00000000000000010000000000000000\nvec($,16, 1) = 1   ==      65536 00000000000000001000000000000000\nvec($,17, 1) = 1   ==     131072 00000000000000000100000000000000\nvec($,18, 1) = 1   ==     262144 00000000000000000010000000000000\nvec($,19, 1) = 1   ==     524288 00000000000000000001000000000000\nvec($,20, 1) = 1   ==    1048576 00000000000000000000100000000000\nvec($,21, 1) = 1   ==    2097152 00000000000000000000010000000000\nvec($,22, 1) = 1   ==    4194304 00000000000000000000001000000000\nvec($,23, 1) = 1   ==    8388608 00000000000000000000000100000000\nvec($,24, 1) = 1   ==   16777216 00000000000000000000000010000000\nvec($,25, 1) = 1   ==   33554432 00000000000000000000000001000000\nvec($,26, 1) = 1   ==   67108864 00000000000000000000000000100000\nvec($,27, 1) = 1   ==  134217728 00000000000000000000000000010000\nvec($,28, 1) = 1   ==  268435456 00000000000000000000000000001000\nvec($,29, 1) = 1   ==  536870912 00000000000000000000000000000100\nvec($,30, 1) = 1   == 1073741824 00000000000000000000000000000010\nvec($,31, 1) = 1   == 2147483648 00000000000000000000000000000001\nvec($, 0, 2) = 1   ==          1 10000000000000000000000000000000\nvec($, 1, 2) = 1   ==          4 00100000000000000000000000000000\nvec($, 2, 2) = 1   ==         16 00001000000000000000000000000000\nvec($, 3, 2) = 1   ==         64 00000010000000000000000000000000\nvec($, 4, 2) = 1   ==        256 00000000100000000000000000000000\nvec($, 5, 2) = 1   ==       1024 00000000001000000000000000000000\nvec($, 6, 2) = 1   ==       4096 00000000000010000000000000000000\nvec($, 7, 2) = 1   ==      16384 00000000000000100000000000000000\nvec($, 8, 2) = 1   ==      65536 00000000000000001000000000000000\nvec($, 9, 2) = 1   ==     262144 00000000000000000010000000000000\nvec($,10, 2) = 1   ==    1048576 00000000000000000000100000000000\nvec($,11, 2) = 1   ==    4194304 00000000000000000000001000000000\nvec($,12, 2) = 1   ==   16777216 00000000000000000000000010000000\nvec($,13, 2) = 1   ==   67108864 00000000000000000000000000100000\nvec($,14, 2) = 1   ==  268435456 00000000000000000000000000001000\nvec($,15, 2) = 1   == 1073741824 00000000000000000000000000000010\nvec($, 0, 2) = 2   ==          2 01000000000000000000000000000000\nvec($, 1, 2) = 2   ==          8 00010000000000000000000000000000\nvec($, 2, 2) = 2   ==         32 00000100000000000000000000000000\nvec($, 3, 2) = 2   ==        128 00000001000000000000000000000000\nvec($, 4, 2) = 2   ==        512 00000000010000000000000000000000\nvec($, 5, 2) = 2   ==       2048 00000000000100000000000000000000\nvec($, 6, 2) = 2   ==       8192 00000000000001000000000000000000\nvec($, 7, 2) = 2   ==      32768 00000000000000010000000000000000\nvec($, 8, 2) = 2   ==     131072 00000000000000000100000000000000\nvec($, 9, 2) = 2   ==     524288 00000000000000000001000000000000\nvec($,10, 2) = 2   ==    2097152 00000000000000000000010000000000\nvec($,11, 2) = 2   ==    8388608 00000000000000000000000100000000\nvec($,12, 2) = 2   ==   33554432 00000000000000000000000001000000\nvec($,13, 2) = 2   ==  134217728 00000000000000000000000000010000\nvec($,14, 2) = 2   ==  536870912 00000000000000000000000000000100\nvec($,15, 2) = 2   == 2147483648 00000000000000000000000000000001\nvec($, 0, 4) = 1   ==          1 10000000000000000000000000000000\nvec($, 1, 4) = 1   ==         16 00001000000000000000000000000000\nvec($, 2, 4) = 1   ==        256 00000000100000000000000000000000\nvec($, 3, 4) = 1   ==       4096 00000000000010000000000000000000\nvec($, 4, 4) = 1   ==      65536 00000000000000001000000000000000\nvec($, 5, 4) = 1   ==    1048576 00000000000000000000100000000000\nvec($, 6, 4) = 1   ==   16777216 00000000000000000000000010000000\nvec($, 7, 4) = 1   ==  268435456 00000000000000000000000000001000\nvec($, 0, 4) = 2   ==          2 01000000000000000000000000000000\nvec($, 1, 4) = 2   ==         32 00000100000000000000000000000000\nvec($, 2, 4) = 2   ==        512 00000000010000000000000000000000\nvec($, 3, 4) = 2   ==       8192 00000000000001000000000000000000\nvec($, 4, 4) = 2   ==     131072 00000000000000000100000000000000\nvec($, 5, 4) = 2   ==    2097152 00000000000000000000010000000000\nvec($, 6, 4) = 2   ==   33554432 00000000000000000000000001000000\nvec($, 7, 4) = 2   ==  536870912 00000000000000000000000000000100\nvec($, 0, 4) = 4   ==          4 00100000000000000000000000000000\nvec($, 1, 4) = 4   ==         64 00000010000000000000000000000000\nvec($, 2, 4) = 4   ==       1024 00000000001000000000000000000000\nvec($, 3, 4) = 4   ==      16384 00000000000000100000000000000000\nvec($, 4, 4) = 4   ==     262144 00000000000000000010000000000000\nvec($, 5, 4) = 4   ==    4194304 00000000000000000000001000000000\nvec($, 6, 4) = 4   ==   67108864 00000000000000000000000000100000\nvec($, 7, 4) = 4   == 1073741824 00000000000000000000000000000010\nvec($, 0, 4) = 8   ==          8 00010000000000000000000000000000\nvec($, 1, 4) = 8   ==        128 00000001000000000000000000000000\nvec($, 2, 4) = 8   ==       2048 00000000000100000000000000000000\nvec($, 3, 4) = 8   ==      32768 00000000000000010000000000000000\nvec($, 4, 4) = 8   ==     524288 00000000000000000001000000000000\nvec($, 5, 4) = 8   ==    8388608 00000000000000000000000100000000\nvec($, 6, 4) = 8   ==  134217728 00000000000000000000000000010000\nvec($, 7, 4) = 8   == 2147483648 00000000000000000000000000000001\nvec($, 0, 8) = 1   ==          1 10000000000000000000000000000000\nvec($, 1, 8) = 1   ==        256 00000000100000000000000000000000\nvec($, 2, 8) = 1   ==      65536 00000000000000001000000000000000\nvec($, 3, 8) = 1   ==   16777216 00000000000000000000000010000000\nvec($, 0, 8) = 2   ==          2 01000000000000000000000000000000\nvec($, 1, 8) = 2   ==        512 00000000010000000000000000000000\nvec($, 2, 8) = 2   ==     131072 00000000000000000100000000000000\nvec($, 3, 8) = 2   ==   33554432 00000000000000000000000001000000\nvec($, 0, 8) = 4   ==          4 00100000000000000000000000000000\nvec($, 1, 8) = 4   ==       1024 00000000001000000000000000000000\nvec($, 2, 8) = 4   ==     262144 00000000000000000010000000000000\nvec($, 3, 8) = 4   ==   67108864 00000000000000000000000000100000\nvec($, 0, 8) = 8   ==          8 00010000000000000000000000000000\nvec($, 1, 8) = 8   ==       2048 00000000000100000000000000000000\nvec($, 2, 8) = 8   ==     524288 00000000000000000001000000000000\nvec($, 3, 8) = 8   ==  134217728 00000000000000000000000000010000\nvec($, 0, 8) = 16  ==         16 00001000000000000000000000000000\nvec($, 1, 8) = 16  ==       4096 00000000000010000000000000000000\nvec($, 2, 8) = 16  ==    1048576 00000000000000000000100000000000\nvec($, 3, 8) = 16  ==  268435456 00000000000000000000000000001000\nvec($, 0, 8) = 32  ==         32 00000100000000000000000000000000\nvec($, 1, 8) = 32  ==       8192 00000000000001000000000000000000\nvec($, 2, 8) = 32  ==    2097152 00000000000000000000010000000000\nvec($, 3, 8) = 32  ==  536870912 00000000000000000000000000000100\nvec($, 0, 8) = 64  ==         64 00000010000000000000000000000000\nvec($, 1, 8) = 64  ==      16384 00000000000000100000000000000000\nvec($, 2, 8) = 64  ==    4194304 00000000000000000000001000000000\nvec($, 3, 8) = 64  == 1073741824 00000000000000000000000000000010\nvec($, 0, 8) = 128 ==        128 00000001000000000000000000000000\nvec($, 1, 8) = 128 ==      32768 00000000000000010000000000000000\nvec($, 2, 8) = 128 ==    8388608 00000000000000000000000100000000\nvec($, 3, 8) = 128 == 2147483648 00000000000000000000000000000001\n\nwait\nBehaves like wait(2) on your system: it waits for a child process to terminate and\nreturns the pid of the deceased process, or \"-1\" if there are no child processes.  The\nstatus is returned in $? and \"${^CHILDERRORNATIVE}\".  Note that a return value of \"-1\"\ncould mean that child processes are being automatically reaped, as described in perlipc.\n\nIf you use \"wait\" in your handler for $SIG{CHLD}, it may accidentally wait for the child\ncreated by \"qx\" or \"system\".  See perlipc for details.\n\nPortability issues: \"wait\" in perlport.\n\nwaitpid PID,FLAGS\nWaits for a particular child process to terminate and returns the pid of the deceased\nprocess, or \"-1\" if there is no such child process.  A non-blocking wait (with WNOHANG in\nFLAGS) can return 0 if there are child processes matching PID but none have terminated\nyet.  The status is returned in $? and \"${^CHILDERRORNATIVE}\".\n\nA PID of 0 indicates to wait for any child process whose process group ID is equal to\nthat of the current process.  A PID of less than \"-1\" indicates to wait for any child\nprocess whose process group ID is equal to -PID.  A PID of \"-1\" indicates to wait for any\nchild process.\n\nIf you say\n\nuse POSIX \":syswaith\";\n\nmy $kid;\ndo {\n$kid = waitpid(-1, WNOHANG);\n} while $kid > 0;\n\nor\n\n1 while waitpid(-1, WNOHANG) > 0;\n\nthen you can do a non-blocking wait for all pending zombie processes (see \"WAIT\" in\nPOSIX).  Non-blocking wait is available on machines supporting either the waitpid(2) or\nwait4(2) syscalls.  However, waiting for a particular pid with FLAGS of 0 is implemented\neverywhere.  (Perl emulates the system call by remembering the status values of processes\nthat have exited but have not been harvested by the Perl script yet.)\n\nNote that on some systems, a return value of \"-1\" could mean that child processes are\nbeing automatically reaped.  See perlipc for details, and for other examples.\n\nPortability issues: \"waitpid\" in perlport.\n\nwantarray\nReturns true if the context of the currently executing subroutine or \"eval\" is looking\nfor a list value.  Returns false if the context is looking for a scalar.  Returns the\nundefined value if the context is looking for no value (void context).\n\nreturn unless defined wantarray; # don't bother doing more\nmy @a = complexcalculation();\nreturn wantarray ? @a : \"@a\";\n\n\"wantarray\"'s result is unspecified in the top level of a file, in a \"BEGIN\",\n\"UNITCHECK\", \"CHECK\", \"INIT\" or \"END\" block, or in a \"DESTROY\" method.\n\nThis function should have been named wantlist() instead.\n\nwarn LIST\nEmits a warning, usually by printing it to \"STDERR\".  \"warn\" interprets its operand LIST\nin the same way as \"die\", but is slightly different in what it defaults to when LIST is\nempty or makes an empty string.  If it is empty and $@ already contains an exception\nvalue then that value is used after appending \"\\t...caught\".  If it is empty and $@ is\nalso empty then the string \"Warning: Something's wrong\" is used.\n\nBy default, the exception derived from the operand LIST is stringified and printed to\n\"STDERR\".  This behaviour can be altered by installing a $SIG{WARN} handler.  If\nthere is such a handler then no message is automatically printed; it is the handler's\nresponsibility to deal with the exception as it sees fit (like, for instance, converting\nit into a \"die\").  Most handlers must therefore arrange to actually display the warnings\nthat they are not prepared to deal with, by calling \"warn\" again in the handler.  Note\nthat this is quite safe and will not produce an endless loop, since \"WARN\" hooks are\nnot called from inside one.\n\nYou will find this behavior is slightly different from that of $SIG{DIE} handlers\n(which don't suppress the error text, but can instead call \"die\" again to change it).\n\nUsing a \"WARN\" handler provides a powerful way to silence all warnings (even the so-\ncalled mandatory ones).  An example:\n\n# wipe out *all* compile-time warnings\nBEGIN { $SIG{'WARN'} = sub { warn $[0] if $DOWARN } }\nmy $foo = 10;\nmy $foo = 20;          # no warning about duplicate my $foo,\n# but hey, you asked for it!\n# no compile-time or run-time warnings before here\n$DOWARN = 1;\n\n# run-time warnings enabled after here\nwarn \"\\$foo is alive and $foo!\";     # does show up\n\nSee perlvar for details on setting %SIG entries and for more examples.  See the Carp\nmodule for other kinds of warnings using its \"carp\" and \"cluck\" functions.\n\nwrite FILEHANDLE\nwrite EXPR\nwrite\nWrites a formatted record (possibly multi-line) to the specified FILEHANDLE, using the\nformat associated with that file.  By default the format for a file is the one having the\nsame name as the filehandle, but the format for the current output channel (see the\n\"select\" function) may be set explicitly by assigning the name of the format to the $~\nvariable.\n\nTop of form processing is handled automatically:  if there is insufficient room on the\ncurrent page for the formatted record, the page is advanced by writing a form feed and a\nspecial top-of-page format is used to format the new page header before the record is\nwritten.  By default, the top-of-page format is the name of the filehandle with \"TOP\"\nappended, or \"top\" in the current package if the former does not exist.  This would be a\nproblem with autovivified filehandles, but it may be dynamically set to the format of\nyour choice by assigning the name to the $^ variable while that filehandle is selected.\nThe number of lines remaining on the current page is in variable \"$-\", which can be set\nto 0 to force a new page.\n\nIf FILEHANDLE is unspecified, output goes to the current default output channel, which\nstarts out as STDOUT but may be changed by the \"select\" operator.  If the FILEHANDLE is\nan EXPR, then the expression is evaluated and the resulting string is used to look up the\nname of the FILEHANDLE at run time.  For more on formats, see perlform.\n\nNote that write is not the opposite of \"read\".  Unfortunately.\n\ny///\nThe transliteration operator.  Same as \"tr///\".  See \"Quote-Like Operators\" in perlop.\n\n#### Non-function Keywords by Cross-reference\n\nperldata\n\nDATA\nEND\nThese keywords are documented in \"Special Literals\" in perldata.\n\nperlmod\n\nBEGIN\nCHECK\nEND\nINIT\nUNITCHECK\nThese compile phase keywords are documented in \"BEGIN, UNITCHECK, CHECK, INIT and END\" in\nperlmod.\n\nperlobj\n\nDESTROY\nThis method keyword is documented in \"Destructors\" in perlobj.\n\nperlop\n\nand\ncmp\neq\nge\ngt\nle\nlt\nne\nnot\nor\nx\nxor These operators are documented in perlop.\n\nperlsub\n\nAUTOLOAD\nThis keyword is documented in \"Autoloading\" in perlsub.\n\nperlsyn\n\nelse\nelsif\nfor\nforeach\nif\nunless\nuntil\nwhile\nThese flow-control keywords are documented in \"Compound Statements\" in perlsyn.\n\nelseif\nThe \"else if\" keyword is spelled \"elsif\" in Perl.  There's no \"elif\" or \"else if\" either.\nIt does parse \"elseif\", but only to warn you about not using it.\n\nSee the documentation for flow-control keywords in \"Compound Statements\" in perlsyn.\n\ndefault\ngiven\nwhen\nThese flow-control keywords related to the experimental switch feature are documented in\n\"Switch Statements\" in perlsyn.\n\n\n\nperl v5.34.0                                 2025-07-25                                  PERLFUNC(1)\n\n"
        }
    ],
    "structuredContent": {
        "command": "PERLFUNC",
        "section": "1",
        "mode": "man",
        "summary": "perlfunc - Perl builtin functions",
        "synopsis": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 72,
                "subsections": [
                    {
                        "name": "Perl Functions by Category",
                        "lines": 110
                    },
                    {
                        "name": "Portability",
                        "lines": 19
                    },
                    {
                        "name": "Alphabetical Listing of Perl Functions",
                        "lines": 7301
                    },
                    {
                        "name": "Non-function Keywords by Cross-reference",
                        "lines": 68
                    }
                ]
            }
        ]
    }
}