IBM Transaction Processing Facility (TPF) V4R1: Using Perl on TPF README CONTENTS 1.0 ABOUT THIS README FILE 1.1 Who should read this README file 1.2 How to get help 2.0 PERL SUPPORT ON TPF (includes Table of TPF-Supported Perl Features) 3.0 GETTING THE PERL CODE FOR TPF 3.1 Downloading 3.2 Extracting 4.0 COMPILING PERL FOR TPF 4.1 Building Miniperl for OS/390 UNIX 4.2 Building Perl for TPF 5.0 INSTALLATION 6.0 TESTING PERL 6.1 Setup 6.2 My First Perl Script 7.0 TECHNICAL DOCUMENTATION AND OTHER SOURCES OF INFORMATION 8.0 NOTICES 8.1 Permission Notices 8.2 Trademarks 1.0 ABOUT THIS README FILE This file contains the latest information for installing the Perl scripting language on a TPF system and was last updated on 30 November 2000. See section 2.0 Perl Support on TPF for important version support information. The procedures described in this document have been tested on an OS/390 UNIX System Services machine running at version 2.6 that contained both OS/390 UNIX and TPF C header files. Throughout this document, we will refer to this machine as OS/390 UNIX. The following conventions are used in this document: Text that you type is shown in bold and is case sensitive. Sample output is shown in monospaced font. Note: Information about Perl is available on several Web sites. Some resources are identified in 7.0 Technical Documentation and Other Sources of Information. 1.1 Who should read this README file This file is intended for those persons who are installing Perl. Those who are using the Perl code and writing Perl scripts can learn more about Perl and the TPF file system through the resources identified in 7.0 Technical Documentation and Other Sources of Information. 1.2 How to get help If you have difficulty installing Perl, contact your TPF service representative. 2.0 PERL SUPPORT ON TPF To use Perl on your TPF system, you must be at TPF V4R1 PUT 13 with APAR PJ27277 installed. TPF only supports Perl version 5.005_03, which is available on the TPF Web page. See 3.0 Getting the Perl Code for TPF for more information about getting the appropriate Perl code. The following extensions are supported in part or in full on the TPF system: Errno Fcntl IO Opcode POSIX Socket Process handling of Perl scripts on TPF varies from UNIX because of differences between the models for creating subprocesses: TPF uses tpf_fork while UNIX uses fork and exec. TPF supports many, but not all, built-in Perl functions and Perl switches. The Table of TPF-Supported Perl Features identifies which functions and which switches are supported. 3.0 GETTING THE PERL CODE FOR TPF Before using Perl on your TPF system, you will need to first download the Perl code from the TPF Web site and then extract the files. 3.1 Downloading To download the Perl code for TPF, do the following: 1.Go to the TPF Web Page and click TPF Tools or go directly to http://www.s390.ibm.com/tpf/tools.htm. 2.Download the Perl source code (perl5.005_03.source_code.tar.Z) and the patches that enable Perl to run on your TPF system (perl5.005_03.tpf_patches.tar.Z) by doing the following: 1.Download each archive to your PC or workstation by clicking the file name and then choosing an appropriate directory. (The instructions that follow assume you have downloaded the archives to your local C:\ drive.) Make sure that you use the .tar.Z extension on the file names. Sometimes browsers do not understand the file extensions and attempt to save the file with a different extension so you may need to reset the file extension to .tar.Z. 2.Use FTP to send the archives to your OS/390 UNIX system by doing the following: 1.Open a DOS window. 2.Enter ftp your.open.edition.machine.com to activate FTP, where your.open.edition.machine.com is the name of your OS/390 UNIX system. 3.Sign in. 4.Enter binary to set the session as binary. 5.Enter send c:\perl5.005_03.source_code.tar.Z perl5.005_03.source_code.tar.Z to send the Perl source code to your OS/390 UNIX system. 6.Enter send c:\perl5.005_03.tpf_patches.tar.Z perl5.005_03.tpf_patches.tar.Z to send the patches to your OS/390 UNIX system. 7.Enter bye to exit FTP. 8.Close the DOS window. (You can also download Perl source code from CPAN: the Comprehensive Perl Archive Network. However, because the patches required for Perl to run on TPF are specific to version 5.005_03, download the Perl source code from the TPF Web site to ensure compatibility.) 3.2 Extracting Each archive is compressed into a tarball. To extract the files from these tarballs, do the following on your OS/390 UNIX system: 1.Ensure both archives are in the same directory on OS/390 UNIX. 2.Enter gunzip perl5.005_03.source_code.tar.Z to decompress the Perl source code. The tar.Z file is replaced by the .tar archive file. 3.Enter gunzip perl5.005_03.tpf_patches.tar.Z to decompress the patches. The tar.Z file is replaced by the .tar archive file. 4.Enter pax -rvkf perl5.005_03.source_code.tar -o from=ISO8859-1,to=IBM-1047 to extract the Perl source code.* 5.Enter pax -rvkf perl5.005_03.tpf_patches.tar -o from=ISO8859-1,to=IBM-1047 to extract the patches.* 6.Enter chmod -R 777 perl5.005_03 to ensure all files are accessible. 7.Enter cp -R perl5.005_03/tpf/* perl5.005_03 to apply the TPF patches by overlaying selected Perl files. * Notes for steps 4 and 5: Using the pax command will extract the files and translate them from ASCII (ISO8859-1) to EBCDIC (IBM-1047). Enter pax -vf archive.tar, where archive is the file name of either the Perl source code or the patches, to view the contents of an archive without extracting any files. The files extracted from these two archives are automatically placed in a new perl5.005_03 subdirectory. The -k option for the pax command prevents the extract from overlaying any existing files or directories. As a result, you will receive (and you can ignore) the following error message after the second entry: FSUM9679 Existing file "perl5.005_03/" exists; it will not be overwritten 4.0 COMPILING PERL FOR TPF The unique Perl build process uses a small version of itself called miniperl to complete the Perl interpreter. This causes problems on systems that do cross-platform compiling, such as TPF. As a result, to compile Perl for TPF, you will first need to create miniperl so that it runs on OS/390 UNIX and then force a complete build against TPF headers and libraries. The build for TPF should not interfere with any existing implementations of Perl on OS/390 UNIX nor will it write into the /usr/local directory. 4.1 Building miniperl for OS/390 UNIX To create miniperl, do the following: 1.Enter cd perl5.005_03 to change to the perl5.005_03 directory. 2.Enter Configure -des to kick off the configuration process. This will take approximately 20 to 30 minutes to be completed but requires no interaction. Your output will be similar to the following: (I see you are using the Korn shell. Some ksh's blow up on Configure, mainly on older exotic systems. If yours does, try the Bourne shell instead.) First let's make sure your kit is complete. Checking... Locating common programs... Checking compatibility between /bin/echo and builtin echo (if any)... (... several screens of output here ...) Finding dependencies for walk.o. echo Makefile.SH cflags.SH | tr ' ' '\n' >.shlist Updating makefile... Now you must run a make. If you compile perl5 on a different machine or from a different object directory, copy the Policy.sh file from this object directory to the new one before you run Configure -- this will help you with most of the policy defaults. You can safely ignore the following error (or diagnostic) messages: /bin/awk: Syntax error Context is: >>> {print $} <<< perly.y -> perly.c perly.y -> perly.h a2p.y -> a2p.c ERROR CBC3198 ./.nnnnnnnn.c:399 #if, #else, #elif, #ifdef, #ifndef block must be ended with #endif. FSUM3065 The COMPILE step ended with return code 12. FSUM3017 Could not compile .nnnnnnnn.c. Correct the errors and try again. 3.Enter make miniperl to compile miniperl for OS/390 UNIX. Your output will be similar to the following: `sh cflags libperl.a miniperlmain.o` miniperlmain.c CCMD = c89 -DPERL_CORE -c -DMAXSIG=38 -DOEMVS -D_OE_SOCKETS -D_XOPEN `sh cflags libperl.a perl.o` perl.c CCCMD = c89 -DPERL_CORE -c -DMAXSIG=38 -DOEMVS -D_OE_SOCKETS -D_XOPEN (... several screens of output here ...) `sh cflags libperl.a ebcdic.o` ebcdic.c CCCMD = c89 -DPERL_CORE -c -DMAXSIG=38 -DOEMVS -D_OE_SOCKETS -D_XOPEN rm -f libperl.a /bin/ar rcu libperl.a perl.o gv.o toke.o perly.o op.o regcomp.o dump.o util.o m c89 -L/usr/local/lib -o miniperl miniperlmain.o libperl.a -lm -lc ./miniperl -w -Ilib -MExporter -e 0 || make minitest 4.2 Building Perl for TPF Once miniperl has been built for OS/390 UNIX, you can build the complete Perl interpreter for TPF by doing the following: 1.Ensure you are in the perl5.005_03 directory. 2.Customize the tpf.exports script by putting in the location of your TPF C header files. This script will set the environment variables required to compile Perl for TPF. 3.Verify that the export variables are valid for your installation; in particular, the system include file directories. The system include files must reside on your OS/390 UNIX system in the appropriate file structure similar to /usr/include and /usr/include/sys. If your system header files contain line numbers in columns 72–80, you must truncate them. The lines that read export _C89_OPTIONS="-W 0,langlvl(extended) -DSTANDARD_C" and export TPF=YES are required for the Perl compilation to work correctly. This example from a customer shows the commands used for the copy process from PDS to HFS: mkdir -m 755 /usr/include mkdir -m 755 /usr/include/sys tso OPUTX "'TPF.CHDR.REL41.LRECL72' '/usr/include/' LC SUFFIX(h)" cp -m /usr/include/types.h /usr/include/sys cp -m /usr/include/stat.h /usr/include/sys cp -m /usr/include/cdefs.h /usr/include/sys cp -m /usr/include/ioctl.h /usr/include/sys cp -m /usr/include/modes.h /usr/include/sys cp -m /usr/include/wait.h /usr/include/sys cp -m /usr/include/ipc.h /usr/include/sys cp -m /usr/include/shm.h /usr/include/sys cp -m /usr/include/socket.h /usr/include/sys 4.Enter . tpf.exports to export TPF compiler settings. The initial period and blank are required to ensure the environment variables exist beyond the scope of the tpf.exports shell script. If you receive either of the following error messages, go back to 4.1 Building miniperl for OS/390 UNIX and complete the miniperl build: tpf.exports: run "Configure -des" first tpf.exports: run "make miniperl" first" Once a successful export of the TPF compiler settings has been completed, you cannot rebuild miniperl for OS/390 UNIX without first clearing the settings. If you must rebuild miniperl, exit and then log on again to clear the settings. 5.To customize the config.sh.tpf file, do the following: 1.Change the /u/tpf41/currentmaint/include string to reflect your TPF C header directory on the following lines: strings='/u/tpf41/currentmaint/include/string.h' timeincl='/u/tpf41/currentmaint/include/sysgtime.h' usrinc='/u/tpf41/currentmaint/include' 2.On the perladmin='someone@your.company.com' line, change the e-mail address to a valid address. 3.Customize the information within single quotation marks (' ') on the following lines with the appropriate information: cf_by='your name' cf_email='you@your.company.com' cf_time='Thu Sep 2 14:34:27 EDT 1999' 4.You have the option to exclude the Errno, Fcntl, IO, Opcode, POSIX, or Socket extensions. To do this, modify the following line by deleting the extension you want to exclude: extensions='Errno Fcntl IO Opcode POSIX Socket' 6.Enter cp config.sh.tpf config.sh to overlay the generated OS/390 UNIX config.sh file with the TPF config.sh.tpf file. If you must rebuild miniperl for OS/390 UNIX, delete config.sh first to force it to be generated again with OS/390 UNIX values. You also must exit and log on again to clear the TPF settings made by tpf.exports. 7.Enter tpf.setup to run a shell script to set up for rebuilding against TPF headers and libraries. Your output will be similar to the following: ./tpf.setup: removing specific files to force rebuild ./tpf.setup: running .SH scripts Extracting Makefile (with variable substitutions) Extracting Policy.sh (with variable substitutions) Extracting cflags (with variable substitutions) Extracting makeaperl (with variable substitutions) Extracting makedepend (with variable substitutions) Extracting makedir (with variable substitutions) Extracting perl.exp Extracting writemain (with variable substitutions) Extracting config.h (with variable substitutions) Extracting x2p/Makefile (with variable substitutions) Extracting x2p/cflags (with variable substitutions) ./tpf.setup: touching .c files to force recompiles against TPF ./tpf.setup: completed 8.Enter make tpf to compile Perl for TPF. Your output will be similar to the following: `sh cflags libperl.a perl.o` perl.c CCCMD = c89 -DPERL_CORE -c -DTPF -D_OE_SOCKETS -D_XOPEN_SOURCE_EXTEND `sh cflags libperl.a gv.o` gv.c CCCMD = c89 -DPERL_CORE -c -DTPF -D_OE_SOCKETS -D_XOPEN_SOURCE_EXTEND ... several screens of output here ... Making Errno (nonxs) Writing Makefile for Errno mkdir ../../lib/auto/Errno ../../miniperl -I../../lib -I../../lib -I../../lib -I../../lib Errno_pm.PL Errno.pm cp Errno.pm ../../lib/Errno.pm You can safely ignore the following error message: ERROR CBC3198 ./.nnnnnnnn.c:399 #if, #else, #elif, #ifdef, #ifndef block must be ended with #endif. FSUM3065 The COMPILE step ended with return code 12. FSUM3017 Could not compile .nnnnnnnn.c. Correct the errors and try again. 5.0 INSTALLATION To install Perl on your TPF system, do the following: Note: Program CHTP has been reserved to allow it to be used for Perl to avoid naming conflicts. If you prefer to use another program name, replace CHTP with your program name. 1.Link the generated Perl object files. Sample link JCL (contained in the linkperl.jcl file) has been included with the TPF patches as an example. You must change the IDs, data set names, and libraries for your particular site. 2.Create a loadset. Sample loadset JCL (contained in the lsetperl.jcl file) has also been included. You must also modify it for your particular site. A JCL condition code of 4 is expected because the C load module will contain no link map data. 3.Enter the ZOLDR LOAD and ZOLDR ACT functional messages to load and activate the loadset on your test system. (See TPF Operations for more information about the ZOLDR LOAD and ZOLDR ACT functional messages.) 6.0 TESTING PERL To test the installation of the Perl code, first complete a setup and then try running your first Perl script. 6.1 Setup Perl must be associated with a program name. Do this by creating a small file in the /usr/bin directory on your TPF system: 1.Enter zfile mkdir /usr to make the directory /usr. 2.Enter zfile mkdir /usr/bin to make the directory /usr/bin. 3.Enter zfile echo "#!CHTP" > /usr/bin/perl to associate the CHTP program with perl. Your output will be as follows: FILE0003I 13.06.55 echo "#!CHT... COMPLETED SUCCESSFULLY. NO OUTPUT TO DISPLAY Additionally, entering zfile cat /usr/bin/perl will return the following: FILE0001I 00.31.45 START OF DISPLAY FROM cat /usr/bin/perl #!CHTP END OF DISPLAY Note: If your output differs from the pervious examples, your test terminal may be assigning special meanings to the double quotation marks ("), the hash symbol (#), or both. 4.Enter zfile chmod 777 /usr/bin/perl to turn on permission bits for the newly created file. 6.2 My First Perl Script To complete the test, enter zfile perl -e 'print "Hello, World!\n";' to pass Perl a script on the command line. Your output will be similar to the following: FILE0001I 13.08.47 START OF DISPLAY FROM /usr/bin/perl -e 'print "Hello, Wor... Hello, World! END OF DISPLAY You will also get the same results by running a Perl script that you create: 1.Enter zfile echo 'print "Hello, World!\n";' > hello.pl to create this simple Perl script directly on TPF. 2.Enter zfile chmod 777 hello.pl to mark the script as executable. 3.Enter zfile perl hello.pl to execute the script. You will get the following results: FILE0001I 01.06.39 START OF DISPLAY FROM perl hello.pl Hello, World! END OF DISPLAY 7.0 TECHNICAL DOCUMENTATION AND OTHER SOURCES OF INFORMATION You can learn more about the Perl scripting language through a variety of resources, including books, Web sites, and classes. The www.perl.com Web site will help you to get started and includes a list of additional resources. Technical documentation for APAR PJ27277 (file system tools) can be found in TPF Family Libraries. For an online version of the books, go to the TPF Family Libraries section of the TPF Web site or go directly to http://www.ibm.com/tpf/pubs/tpfpubs.htm. The following books were updated for APAR PJ27277: TPF Application Programming TPF C/C++ Language Support User's Guide TPF Library Guide TPF Migration Guide: Program Update Tapes TPF Operations TPF System Macros 8.0 NOTICES References in this book to IBM products, programs, or services do not imply that IBM intends to make these available in all countries in which IBM operates. Anyreference to an IBM product, program, or service in this book is not intended to state or imply that only IBM's product, program, or service may be used. Any functionally equivalent product, program, or service that does not infringe any of IBM's intellectual property rights may be used instead of the IBM product, program, or service. Evaluation and verification of operation in conjunction with other products, except those expressly designated by IBM, is the user's responsibility. IBM may have patents or pending patent applications covering subject matter in this document. The furnishing of this document does not give you any license to these patents. You can send license inquiries, in writing, to: IBM Director of Licensing IBM Corporation North Castle Drive Armonk, NY 10504-1785 USA Licensees of this program who wish to have information about it for the purpose of enabling: (i) the exchange of information between independently created programs and other programs (including this one) and (ii) the mutual use of the information which has been exchanged, should contact: IBM Corporation Department 830A Mail Drop P131 2455 South Road Poughkeepsie, NY 12601-5400 USA Such information may be available, subject to appropriate terms and conditions, including in some cases, payment of a fee. 8.1 Permission Notices The following acknowledges software from other sources: This software and documentation is based in part on the Fourth Berkeley Software Distribution under license from The Regents of the University of California. We acknowledge the following individuals and institutions for their role in its development: The Regents of the University of California and the Electrical Engineering and Computer Sciences Department at the Berkeley Campus of the University of California. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1.Redistribution of source code must retain the copyright notice which appears in the source code, this list of conditions and the following disclaimer. 2.Redistributions in binary form must reproduce the copyright notice which appears in the source code, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3.All advertising materials mentioning features or use of this software must display the following acknowledgment: This product includes software developed by the University of California, Berkeley, and its contributors. 4.Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENTS OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS, OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This package is built upon the SGI Standard Template Library (STL) public distribution (v3.0, Oct. 28, 1997), which is: Copyright 1994 Hewlett-Packard Company. Copyright 1996, 1997 Silicon Graphics Computer Systems, Inc. That material is provided pursuant to the following permission notices: Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appears in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Hewlett-Packard Company makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appears in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Silicon Graphics makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. The adaptation is: Copyright 1997 Moscow Center for SPARC Technology. You may freely use, copy, modify, or distribute this software and its documentation for any purpose, provided that both the copyright notice and permission notices from Silicon Graphics & Hewlett-Packard and this copyright notice and permission notice appear in all copies. Moscow Center for SPARC Technology makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. 8.2 Trademarks The following terms are trademarks of the IBM Corporation in the United States or other countries or both: IBM MVS OS/390 UNIX OS/390 Microsoft, Windows, Windows NT, and the Windows logo are registered trademarks of Microsoft Corporation in the United States, other countries, or both. UNIX is a registered trademark of The Open Group in the United States and other countries. Other company, product, and service names may be trademarks or service marks of others. Switches | Built-In Functions | Top of Page | Close this Window Table of TPF-Supported Perl Features: Switches and Built-In Functions In the following table, the first column identifies the Perl switch or function, the second column describes that feature, and the third column indicates whether or not that feature is supported on TPF. (If the feature has not been tested on TPF and is not officially supported, it is labeled as Not Evaluated.) Additional resources for using Perl on your TPF system are identified in section 7.0 Technical Documentation and Other Sources of Information Switches Supported on TPF Switch Description TPF Support? -- Terminates switch processing, even if the next argument starts with a minus. It has no other effect. Yes -0[octal] Specify record separator (\\0, if no argument). Yes -a Autosplit mode with -n or -p (splits $_ into @F). Yes -c Check syntax only (runs BEGIN and END blocks). Yes -d[:debugger] Run scripts under debugger. No -D[number/list] Set debugging flags (argument is a bit mask or flags). No -e 'command' One line of script. Several -e's allowed. Omit [programfile] Yes -F/pattern/ Split() pattern for autosplit (-a). The //'s are optional. Yes -h Shows help display. Yes -i[extension] Edit <> files in place. (Make backup if extension supplied.) Yes -Idirectory Specify @INC/#include directory. (May be used more than once.) Yes -l[octal] Enable line ending processing. Specifies line terminator. Yes -[Mm][-]module.. Executes 'use/no module...' before executing your script. Not evaluated -n Assume 'while (<>) { ... }' loop around your script. Yes -p Assume loop like -n but print line also like sed. Yes -P Run script through C preprocessor before compilation. No -s Enable some switch parsing for switches after script name. Yes -S Look for the script using PATH environment variable. Yes -T Turn on tainting checks. Yes -u Dump core after parsing script. No -U Allow unsafe operations. Not evaluated -v Print version number, patch level, plus very important perl info. Yes -V Print perl configuration information. Yes -V[:variable] Print perl configuration information, specifically "variable". Yes -w Turn warnings on for compilation of your script. Yes -x Strip off text before #!perl line. Yes -x directory Strip off text before #!perl line and cd to directory. No Switches | Built-In Functions | Top of Page | Close this Window Built-In Perl Functions Supported on TPF Function Description TPF Support? -filetest A file test (-r, -x, etc). Yes abs Absolute value function. Yes accept Accept an incoming socket connect. No alarm Schedule a SIGALRM. Yes atan2 Arctangent of Y/X. Yes bind Binds an address to a socket. Yes binmode Prepare binary files on old systems. Yes bless Create an object. Yes caller Get context of the current subroutine call. Yes chdir Change your current working directory. Yes chmod Changes the permissions on a list of files. Yes chomp Remove a trailing record separator from a string. Yes chop Remove the last character from a string. Yes chown Change the ownership on a list of files. Yes chr Get character this number represents. Yes chroot Make directory new root for path lookups. No close Close file (or pipe or socket) handle. Yes closedir Close directory handle. Yes connect Connect to a remove socket. Yes continue Optional trailing block in a while or foreach. Yes cos Cosine function. Yes crypt One-way passwd-style encryption. Not evaluated dbmclose Breaks binding on a tied DBM file. No dbmopen Create binding on a tied DBM file. No defined Test whether a value, variable, or function is defined. Yes delete Deletes a value from a hash. Yes die Raise an exception or bail out. Yes do Turn a BLOCK into a TERM. Yes dump Create an immediate core dump. Not evaluated each Retrieve the next key/value pair from a hash. Yes endgrent Be done using group file. Not evaluated endhostent Be done using hosts file. Not evaluated endnetent Be done using networks file. Not evaluated endprotoent Be done using protocols file. Not evaluated endpwent Be done using passwd file. Yes endservent Be done using services file. Not evaluated eof Test a filehandle for its end. Yes eval Catch exceptions or compile code. Yes exec Abandon this program to run another. Yes exists Test whether a hash key is present. Yes exit Terminate this program. Yes exp Raise I to a power. Yes fcntl File control system all. Not evaluated fileno Return file descriptor from filehandle. Yes flock Lock an entire file with an advisory lock. No fork Create a new process just like this one. No format Declare a picture format with use by the write() function. Yes formline Internal function used for formats. Yes getc Get the next character from the filehandle. Yes getgrent Get next group record. Not evaluated getgrgid Get group record given group user ID. Not evaluated getgrnam Get group record given group name. Not evaluated gethostbyaddr Get host record given its address. Not evaluated gethostbyname Get host record given name. Not evaluated gethostent Get next hosts record. Not evaluated getlogin Return who logged in at this tty. Not evaluated getnetbyaddr Get network record given its address. Not evaluated getnetbyname Get networks record given name. Not evaluated getnetent Get next networks record. Not evaluated getpeername Find the other end of a socket connection. Yes getpgrp Get process group. Not evaluated getppid Get parent process ID. Not evaluated getpriority Get current nice value. Not evaluated getprotobyname Get protocol record given name. Not evaluated getprotobynumber Get protocol record numeric protocol. Not evaluated getprotoent Get next protocols record. Not evaluated getpwent Get next passwd record. Yes getpwnam Get passwd record given user login name. Not evaluated getpwuid Get passwd record given user ID. Not evaluated getservbyname Get services record given its name. Not evaluated getservbyport Get services record given numeric port. Not evaluated getservent Get next services record. Not evaluated getsockname Retrieve the sockaddr for a given socket. Not evaluated getsockopt Get socket options on a given socket. Not evaluated glob Expand filenames using wildcards. Yes gmtime Convert UNIX time into record or string using Greenwich mean time. Yes goto Create spaghetti code. Yes grep Locate elements in a list test true against a given criterion. Yes hex Convert a string to a hexadecimal number. Yes import Patch a module's namespace into your own. Yes index Find a substring within a string. Yes int Get the integer portion of a number. Yes ioctl System-dependent device control system call. Not evaluated join Join a list into a string using a separator. Yes keys Retrieve list of indices from a hash. Yes kill Send a signal to a process or process group. Yes last Exit a block prematurely. Yes lc Return lowercase version of a string. Yes lcfirst Return a string with just the next letter in lowercase. Not evaluated length Return the number of bytes in a string. Yes link Create a hard link in the file system. Yes listen Register your socket as a server. No local Create a temporary value for a global variable (dynamic scoping). Yes localtime Convert UNIX time into record or string using local time. Yes log Retrieve the natural logarithm for a number. Yes lstat Stat a symbolic link Not evaluated m// Match a string with a regular expression pattern. Yes map Apply a change to a list to get back a new list with the changes. Yes mkdir Create a directory. Yes msgctl SysV IPC message control operations. No msgget Get SysV IPC message queue. No msgrcv Receive a SysV IPC message from a message queue. No msgsnd Send a SysV IPC message to a message queue. No my Declare and assign a local variable (lexical scoping). Yes next Iterate a block prematurely. Yes no Unimport some module symbols or semantics at compile time. Yes oct Convert a string to an octal number. Yes open Open a file, pipe, or descriptor. Yes opendir Open a directory. Yes ord Find a character's numeric representation. Yes pack Convert a list into a binary representation. Yes package Declare a separate global namespace. Yes pipe Open a pair of connected filehandles. Yes pop Remove the last element from an array and return it. Yes pos Find or set the offset for the last/next m//g search. Yes print Output a list to a filehandle. Yes printf Output a formatted list to a filehandle. Yes prototype Get the prototype (if any) of a subroutine. Yes push Append one or more elements to an array. Yes q/STRING/ Singly quote a string. Yes qq/STRING/ Doubly quote a string. Yes quotemeta Quote regular expression magic characters. Yes qw/STRING/ Quote a list of words. Yes qx/STRING/ Backquote quote a string. Yes rand Retrieve the next pseudorandom number. Yes read Fixed-length buffered input from a filehandle. Yes readdir Get a directory from a directory handle. Yes readlink Determine where a symbolic link is pointing. Not evaluated recv Receive a message over a socket. Not evaluated redo Start this loop iteration over again. Yes ref Find out the type of thing being referenced. Yes rename Change a file name. Yes require load in external functions from a library at run time. Yes reset Clear all variables of a given name. Yes return Get out of a function early. Yes reverse Flip a string or a list. Yes rewinddir Reset directory handle. Yes rindex Right-to-left substring search. Yes rmdir Remove a directory. Yes s/// Replace a pattern with a string. Yes scalar Force a scalar context. Yes seek Reposition file pointer for random-access I/O. Yes seekdir Reposition directory pointer. Not evaluated select Reset default output or do I/O multiplexing. Yes semctl SysV semaphore control operations. No semget Get set of SysV semaphores. No semop SysV semaphore operations. No send Send a message over a socket. Not evaluated setgrent Prepare group file for use. Not evaluated sethostent Prepare hosts file for use. Not evaluated setnetent Prepare networks file for use. Not evaluated setpgrp Set the process group of a process. Not evaluated setpriority Set the nice value for a process. No setprotoent Prepare protocols file for use. Not evaluated setpwent Prepare passwd file for use. Not evaluated setservent Prepare services file for use. Not evaluated setsockopt Set some socket options. Not evaluated shift Remove the first element of an array, and return it. Yes shmctl SysV shared memory operations. No shmget Get SysV shared memory segment identifier. No shmread Read SysV shared memory. No shmwrite Write SysV shared memory. No shutdown Close down just half of a socket connection. Not evaluated sin Return the sin of a number. Yes sleep Block for some number of seconds. Yes socket Create a socket. Yes socketpair Create a pair of sockets. Not evaluated sort Sort a list of values. Yes splice Add or remove elements anywhere in an array. Yes split Split up a string using a regexp delimiter. Yes sprintf Formatted print into a string. Yes sqrt Square root function. Yes srand Seed the random number generator. Yes stat Get status information for a file. Yes study Optimize input data for repeated searches. Yes sub Declare a subroutine, possibly anonymously. Yes substr Get or alter a portion of a string. Yes symlink Create a symbolic link to a file. Yes syscall Execute an arbitrary system call. Not evaluated sysread Fixed-length unbuffered input from a filehandle. No system Run a separate program. No syswrite Fixed-length unbuffered output to a filehandle. No tell Get current seekpointer on a filehandle. Not evaluated telldir Get current seekpointer on a directory handle. Not evaluated tie Bind a variable to an object class. Yes time Return number of seconds since 1970. Yes times Return elapsed time for self and child processes. No tr/// Transliterate a string. Yes truncate Shorten a file. No uc Return uppercase version of a string. Yes ucfirst Return a string with just the next letter in uppercase. Not evaluated umask Set file creation mode mask. Yes undef Remove a variable or function definition. Yes unlink Remove one link to a file. Yes unpack Convert binary structure into normal perl variables. Yes unshift Prepend more elements to the beginning of a list. Yes untie Break a tie binding to a variable. Yes use Load a module and import its namespace. Yes use Load in a module at compile time. Yes utime Set last access and modify times of a file. Yes values Return a list of the values in a hash. Yes vec Test or set particular bits in a string. Yes wait Wait for any child process to die. Not evaluated waitpid Wait for a particular child process to die. Not evaluated wantarray Get list vs array context of current subroutine call. Yes warn Print debugging info. Yes write Print a picture record. Yes y/// Transliterate a string. Yes Switches | Built-In Functions | Top of Page | Close this Window