Programming Perl, Second Edition

Previous Glossary  


actual arguments

The scalar values that you supply to a function or subroutine when you call it. For instance, when you call piglatin(`bingo`), the string "bingo" is the actual argument. See also argument [1] and formal arguments.

[1] When we italicize a word or phrase in here, it usually means you can find it defined elsewhere in the Glossary. Think of them as hyperlinks.

address operator

A language construct for manipulating the actual location of an object in your computer's memory. Strictly speaking, there are no such operators in Perl, since it handles all that for you automatically. You tell Perl that you want a new thingy, and Perl worries about creating, moving, and destroying the thingy for you. Not so strictly speaking, the backslash operator returns a reference to a thingy, which works much like an address. See also network address.


A list of possible choices from which you may select only one, as in "Would you like door A, B, or C?" Alternatives in regular expressions are separated with a vertical bar: |. Alternatives in normal Perl expressions are separated with a double vertical bar: ||. You might say there are two alternatives for alternatives. (Then again, you might not. Your choice.)


Used to describe a thingy that is not directly accessible through a named variable. Such a thingy must be indirectly accessible through at least one hard reference. When the last hard reference goes away, the anonymous thingy is destroyed without pity.


The kind of computer you're working on, where one "kind" of computer means all those computers that can run the same binary program. Since Perl scripts are text files, not binaries, a Perl script is much less sensitive to the architecture it's running on than programs in other languages (such as C) that are compiled into machine code. See also operating system.


A piece of data supplied as input to a program, subroutine, or function when it is invoked to tell it what it's supposed to do. Also called a "parameter".


The name of the array containing the argument "vector" from the command line. If you use the empty <> operator, ARGV is both the name of the filehandle used to traverse the arguments, and of the scalar containing the name of the current input file. It's also what you say to your dentist when the Novocaine isn't working.

arithmetic operator

A symbol such as + or ** that tells Perl to do arithmetic. In addition, see operator.


A named list of values, each of which has a unique key to identify it. In a normal array, the key is numeric (an integer, in fact). In a hash (an associative array), the key is a string.

array context

A quaint, archaic expression used by people who have read the first edition of this book. Nowadays called list context.

array literal

Strictly, a comma-separated, parenthesized LIST of scalar literals. Used loosely to refer to any parenthesized LIST even if it contains variables or expressions.

array value

Another archaic phrase. See list value.

array variable

A named list that may be processed by functions such as shift and splice that require an array name as the first argument.


Used roughly to mean the American Standard Code for Information Interchange (a 7-bit character set), and any international extensions based on it.


An operation whose mission in life is to change the value of a variable.

assignment operator

A compound operator composed of an ordinary assignment together with some other operator, that changes the value of a variable in place, that is, relative to its old value. For example, $a += 2 adds 2 to $a.

associative array

See hash.


Determines whether you do the left operator first or the right operator first, when you have "A operator B operator C", if the two operators are of the same precedence. Operators like + are left associative, while operators like ** are right associative. See the section "Operators" in Chapter 2, The Gory Details, for a list of associativity.


To add one to something automatically. Usually used to describe the ++ operator.


To split a string automatically on whitespace, such as the -a switch does in order to emulate awk.


Short for "array value", which refers to one of Perl's internal data types. (Not to be confused with array value, by which people usually mean list value.) An AV is a kind of SV.


Descriptive editing term--short for "awkward". Also coincidentally refers to a venerable text processing language from which Perl derived some of its ideas.


The practice of saying, "If I had to do it all over, I'd do it differently," and then actually going back and doing it all over differently. Mathematically speaking, it's returning from an unsuccessful recursion on a tree of possibilities. Backtracking happens in Perl when it attempts to match patterns with a regular expression, and its earlier guesses don't pan out.

base class

A generic object class from which other more specific classes are derived genetically by inheritance. Also called a "superclass" by people who respect their ancestors.


Another ancient language, from which Perl derived exactly one idea. OK, maybe two.[2]

[2] BASIC/PLUS is a registered trademark of Digital Equipment Corporation. And the answers are: statement modifiers and maybe formats.


From Swift: someone who eats boiled eggs big end first. Also used of computers that store the most significant byte of a word at a lower byte address than the least significant byte. Often considered superior to little-endian machines. See also little-endian.


Having to do with numbers represented in base two. That means there are basically two numbers, zero and one. Some people think in binary, as shown by the kinds of questions they ask: "Should we all use Perl or Java?" Also used to describe a non-text file, presumably because such a file makes full use of all the binary bits in its bytes.


A very small piece of litter. Also a number in the range zero to one, inclusive.

bit shift

The movement of bits left or right in a computer word, which has the effect of multiplying or dividing by a power of two.


In corporate life, to grant official approval to a thing, as in, "The VP of Engineering has blessed our WebCruncher project." Similarly in Perl, to grant official approval to a thingy so that it can function as a WebCruncher object. See the bless function in Chapter 3, Functions.


What a process does when it has to wait for something: "My process blocked waiting for the disk." As an unrelated noun, it refers to a large chunk of data, of a size that the operating system likes to deal with (normally a power of two such as 512 or 8192). Typically refers to a chunk of data that's coming from or going to a disk file.


A syntactic construct consisting of a sequence of Perl statements bounded by braces. The if and while statements are defined in terms of BLOCKs. Sometimes we also say "block" to mean a sequence of statements that act like a BLOCK, such as within an eval or a file, even though the statements aren't bounded by braces.

block buffering

A method of making input and output efficient by doing it a block at a time. By default, Perl does block buffering to disk files. See buffer and command buffering.

Boolean context

A special kind of scalar context in which the program is expecting to decide whether the scalar value returned by an expression is true or false. See context.


A spot in your program where you've told the debugger to stop execution so you can poke around and see whether anything is wrong yet.


A psychoactive drug, popular in the 80s, probably developed at U. C. Berkeley or thereabouts. Similar in many ways to the prescription-only medication called "System V", but infinitely more useful. (Or, at least, more fun.) The full chemical name is "Berkeley Standard Distribution".


A temporary holding location for data. Block buffering means that the data is passed on to its destination whenever the buffer is full. Line buffering means that it's passed on whenever a complete line is received. Command buffering means that it's passed on after every print command. If your output is unbuffered, every byte is transmitted separately, without passing through a holding area.


A piece of data worth eight bits in most places.


A pidgin-like language spoken among 'droids when they don't wish to reveal their orientation (see endian). Named after some similar languages spoken (for similar reasons) between compilers and interpreters in the late twentieth century. These languages are characterized by representing everything as a non-architecture-dependent sequence of bytes.


A language beloved by many for its inside-out type definitions, inscrutable precedence rules, and heavy overloading of the function-call mechanism. (Well, actually, people first switched to C because they found lower-case identifiers easier to read than upper.) The Perl interpreter is written in C, so it's not surprising that Perl borrowed a few ideas from it.

C preprocessor

The typical C compiler's first pass, which processes lines beginning with # for conditional compilation and macro definition, and does various manipulations of the program text based on the current definitions. Also known as cpp (1).

call by reference

An argument-passing mechanism in which the formal arguments refer directly to the actual arguments, and the subroutine can change the actual arguments by changing the formal arguments. See also call by value.

call by value

An argument-passing mechanism in which the formal arguments refer to a copy of the actual arguments, and the subroutine cannot change the actual arguments by changing the formal arguments. (See also call by reference).


A small pattern of bits (usually seven, eight, or sixteen in number) that is the machine's representation of a unit of orthography. Americans typically confuse characters with bytes. So does Perl.

character class

A square-bracketed list of characters used in a regular expression to indicate that any character of the set may occur at this point.


A package that either defines methods (subroutines) that deal with objects of your class, or that derives methods from other packages that know how to deal with objects of your class. (Or think they know how.) See also inheritance.

class method

A method that treats the whole class as an object. One sort of class method is a constructor. (A class method is also known as a "static" method in C++ terminology.)


In networking, a process that initiates contact with a server process in order to exchange data with it and perhaps receive a service.


An anonymous subroutine that, when generated at run-time, keeps track of the identities of externally visible lexical variables even after those lexical variables have supposedly gone out of scope. They're called "closures" because this sort of behavior gives mathematicians a sense of closure.


The word "CODE" is returned by the ref function when you apply it to a CV. See CV.

collating sequence

The order that characters sort into. This is used by string comparison routines to decide, for example, where in this glossary to put "collating sequence".


In shell programming, the syntactic combination of a program name with its arguments. More loosely, anything you type to a shell (a command interpreter) that starts it doing something. In Perl programming, a statement, which might start with a label, and typically ends with a semicolon.

command buffering

An option in Perl that lets you store up the output of each Perl command and then flush it out as a single request to the operating system. It's enabled by setting the $| variable to a non-zero value. It's used when you don't want data sitting around not going where it's supposed to, which may happen because the default on a file or pipe is to use block buffering. See also buffering.

command-line arguments

The values you supply along with a program name when you tell a shell to execute a command. These values are passed to a Perl script through @ARGV.

command name

The name of the program currently executing, as typed on the command line. In C the command name is passed to the program as the first command-line argument. In Perl, it comes in separately as $0.


A remark that doesn't affect the meaning of the program. In Perl, a comment is introduced by a # character and continues to the end of the line.


The time when Perl is trying to make sense of your program, as opposed to when it thinks it knows what your program means and is merely trying to do what it thinks your program says to do. See also run-time.


Strictly speaking, a program that munches up another program and spits out yet another file containing the program in a more executable form, typically containing native machine instructions. The perl program is not a compiler by this definition, but it does contain a compiler that takes a program and turns it into a more executable form (syntax trees) within the perl process itself, which the interpreter then interprets. There are, however, extension modules to get Perl to act more like a real compiler.


A "constructor" for a thingy that isn't really an object, like an array or a hash. For example, a pair of braces acts as a composer for a hash, and a pair of brackets acts as a composer for an array. See "Creating Hard References" in Chapter 4, References and Nested Data Structures.


The process of gluing one cat's nose to another cat's tail. Also, a similar operation on two strings.


Something "iffy".


In telephony, the temporary electrical circuit between the caller's and the callee's phone. In networking, the same kind of temporary circuit between a client and a server.


As a noun, a piece of syntax made up of smaller pieces. As a transitive verb, to create an object using a constructor.


A special class method that constructs an object and returns it. Sometimes we use the term loosely to mean a composer.


The surroundings, or environment. The context given by the surrounding code determines what kind of data a particular expression is expected to return. The two primary contexts are list context and scalar context. Scalar context is sometimes subdivided into Boolean context, numeric context, and string context. There's also a "don't care" context (which is dealt with in Chapter 2, The Gory Details, if you care).


The treatment of more than one physical line as a single logical line. Makefile lines are continued by putting a backslash before the newline. Internet message headers are continued by putting a space or tab after the newline. Perl lines do not need any form of continuation mark, because whitespace (including newline) is gleefully ignored. Usually.

core dump

The corpse of a process, in the form of a file left in the working directory of the process, usually as a result of certain kinds of fatal error.


Comprehensive Perl Archive Network. (See the Preface for more details.)

current package

Which package the current statement is compiled in. Scan backward in the text of your program until you find a package declaration at the same block level, or in an enclosing block. That's your current package name.

current working directory

See working directory.

currently selected output channel

The last filehandle that was designated with select(FILEHANDLE); the default is STDOUT, if no filehandle has been selected.


An internal "code value" typedef. A CV is a kind of SV.

dangling statement

A bare, single statement, without any braces, hanging off an if or while conditional. C allows them. Perl doesn't.

data flow

What your program looks like from the perspective of a particular piece of data from the time it enters your program to the time it leaves or is combined with some other data to make new data.

data reduction

The process of extracting only the most interesting tidbits because the boss can't read fast enough.

data structure

How your various pieces of data relate to each other, and what shape they make when you put them all together, as in a rectangular table, or a triangular-shaped tree.

data type

A set of possible values, together with all the operations that know how to deal with those values. For example, a numeric data type has a certain set of numbers that you can work with, and it has various mathematical operations you can do on the numbers that would make little sense on, say, a string such as "Kilroy". Strings have their own operations, such as concatenation. Compound types made of a number of smaller pieces generally have operations to compose and decompose them, and perhaps to rearrange them. Objects that model things in the real world often have operations that correspond to real activities. For instance, if you model an elevator, your elevator object might have an open_door() method.


Stands for "Data Base Management" routines, a set of routines that emulate an associative array using disk files. The routines use a dynamic hashing scheme to locate any entry with only two disk accesses. DBM files allow a Perl script to keep a persistent hash across multiple invocations. You can tie your hash variables to various DBM implementations--see Chapter 5, Packages, Modules, and Object Classes.


An assertion you make that something exists and perhaps what it's like, without any commitment as to how or where you'll use it. A declaration is like the part of your recipe that says, "two cups flour, one large egg, four or five tadpoles...." See statement for its opposite. Note that some declarations also function as statements.


To subtract one from something.


A value that is chosen for you if you don't supply a value of your own.


Having a meaning. Perl thinks that some of the things people try to do are devoid of meaning; in particular, making use of variables that have never been given a value, and performing certain operations on data that isn't there. For example, if you try to read data past the end of a file, Perl will hand you back an undefined value. See also false.


Some character or string that sets bounds to an arbitrarily-sized textual object.


A fancy computer science term meaning "to follow a reference to what it points to". The "de" part of it refers to the fact that you're taking away one level of indirection.

derived class

A class that defines some of its methods in terms of a more generic class, called a base class. Note that classes aren't classified exclusively into base classes or derived classes: a class can function as both a derived class and a base class simultaneously.


To deallocate the memory of a thingy.


A special method that is called when an object is thinking about destroying itself.


A whiz-bang hardware gizmo (like a disk or tape drive) attached to your computer that the operating system tries to make look like a file (or a bunch of files). Under UNIX, these fake files tend to live in the /dev directory.


A place where you find files, and perhaps other directories. Some operating systems call these "folders", "drawers", or "catalogs".

directory handle

A name that represents a particular instance of opening a directory to read it, until you close it.


A Perl statement that is one of the many ways to get a Perl program to produce a core dump. Most of the others are undocumented.

dynamic scoping

Making variables visible throughout the rest of the block in which they are first used, as well as within any subroutines that are called by the rest of the block. Dynamically scoped variables can have their values temporarily changed (and implicitly restored later) by a local statement. Compare Lexical Scoping. Used more loosely to mean how a subroutine that is in the middle of calling another subroutine "contains" that subroutine at run-time.


Derived from many sources. Some would say too many.


A basic building block. When you're talking about an array, it's one of the items that make up the array.


See little-endian and big-endian.


The collective set of environment variables your process inherits from its parent. Accessed via %ENV.

environment variable

A mechanism by which some high-level agent such as a user can pass its preferences down to child processes, grandchild processes, greatgrandchild processes, and so on. Each environment variable is a key/value pair, like one element of a hash.


End of File. Sometimes used metaphorically as the trailing delimiter of a here document.


The error number returned by a UNIX system call when it fails. Perl refers to the error by the name $! (or $OS_ERROR if you use the English module).


A fancy term for an error. See fatal error.

exception handling

The way a program responds to an error. The exception handling mechanism in Perl is the eval construct.

executable file

A file that is specially marked to tell the operating system that it's OK to run this file as a program. Abbreviated to "executable".


To run a program or subroutine. (Has nothing to do with the kill command, unless you're trying to run a signal handler.)

execute bit

The special mark that tells the operating system it can run this program. There are actually three execute bits under UNIX, and which bit gets used depends on whether you own the file singularly, collectively, or not at all.

exit status

See status.


The part of a floating-point number that says where to put the decimal point in the other part. See mantissa.


To make symbols from your module available for import by other modules.


Anything you can legally say in a spot where a value is required. Typically composed of literals, variables, operators, functions, and subroutine calls.


In Perl, any value that would look like "" or "0" if evaluated in a string context. Since undefined values evaluate to "", all undefined values are false, but not all false values are undefined.

fatal error

An error that causes termination of the process after printing a nasty message on your standard error stream. "Fatal" errors that happen inside an eval aren't fatal to the whole program, just to that particular eval. The nasty message then shows up in the $@ variable. You can cause a fatal error with the die operator. This is also known as throwing or raising an exception.


A single piece of numeric or string data that is part of a longer string, record, or line. Variable-width fields are usually separated by delimiters (so use split to extract the fields), while fixed-width fields are usually at fixed positions (so use unpack).


A named collection of data, usually stored on a disk in a directory. Roughly like a document, if you're into office metaphors. In some operating systems like UNIX, you can actually give a file more than one name.

file descriptor

The little number the operating system uses to keep track of which opened file you're talking about. Perl hides the file descriptor inside a standard I/O stream, and then attaches the stream to a filehandle.

file glob

A "wildcard" match on filenames.

file test operator

A built-in Perl operator that you use to determine whether something is true about a file, such as whether you could open it if you tried.


What you pick up a file with. Or, a name (not necessarily related to the real name of a file) that represents a particular instance of opening a file until you close it. Thus if you're going to open and close several different files in succession, it's possible to open each of them with the same filehandle, so you don't have to write out separate code to process each file. It's like the game show host calling someone "Contestant #1" so that he doesn't have to remember too many names from day to day.


The name for a file. This name is listed in a directory, and you can use it in an open statement to tell the operating system exactly which file you want to open.


A set of directories and files residing on a partition of the disk. You can move a file around from directory to directory within a filesystem without actually moving the file itself, at least under UNIX.

floating point

A method of storing numbers in scientific notation, such that the precision of the number is independent of its magnitude (the decimal point "floats"). Perl does its numeric work with floating-point numbers, when it can't get away with using integers.


The act of emptying a buffer, often before it's full.


To create a child process identical to the parent process, at least until it gets ideas of its own.

formal arguments

Generic names a subroutine knows its arguments by. In many languages, formal arguments are always given individual names, but in Perl they are passed via arrays. The formal arguments to a Perl program are $ARGV[0], $ARGV[1], and so on. The formal arguments to a Perl subroutine are $_[0], $_[1], and so on. You may give the arguments individual names by assigning the values to a local or my list.


A specification of how many spaces and digits and things to put somewhere so that whatever you're printing comes out nice and pretty.

freely available

Means you don't have to pay money to get it, but the copyright on it may still belong to someone else (like Larry).

freely redistributable

Means you're not in trouble if you give a bootleg copy of it to your friends (hint).


Mathematically, a mapping of each of a set of input values to a particular output value. In computers, refers to a subroutine or operation that returns a value. It may or may not have input values (called arguments).

garbage collection

A misnamed feature of some programming languages--it should be called "expecting your mother to pick up after you". Strictly speaking, Perl doesn't do this, but relies on a reference counting mechanism to keep things tidy. However, when your interpreter thread exits, a kind of garbage collector runs to make sure everything is cleaned up if you've been messy with circular references and such.


Group ID--in UNIX, the numeric group ID that the operating system uses to identify you and members of your group.


Strictly, the shell's * character, which will match a "glob" of characters when you're trying to generate a list of filenames. Loosely, the act of using globs and similar symbols to do pattern matching.


Something you can see from anywhere, usually used of variables and subroutines that are visible everywhere in your program. In Perl, only certain special variables are truly global--most variables (and all subroutines) are local to the current package.


A set of users that you're a member of. In some operating systems (like UNIX), you can give certain file access permissions to other members of your group.


An internal "glob value", meaning a typeglob. A GV is a kind of SV.

hard reference

A scalar value containing the actual address of a thingy, such that the thingy's reference count accounts for it. (Some hard references are held internally, such as the implicit reference from one of a typeglob's variable slots to its corresponding thingy.) A hard reference is different from a symbolic reference.


A relationship between two objects that is more tenuous than an is-a relationship, and that can be modeled by containment of one object in another (which in Perl means containment of a reference to the contained object.) You generally don't want to use inheritance to model the has-a relationship because methods that make sense on the contained object probably don't make sense on the object as a whole. Just because your car has-a brake pedal doesn't mean you should stomp on your car.


A named list of key/value pairs, arranged such that you can easily use any key to find its associated value; a binary relation, to database users. This glossary is like a hash, where the word to be defined is the key, and the definition is the value. A hash is also sometimes called an "associative array". (Which is a good reason for calling it a hash instead.)

hash table

A method used internally by Perl for implementing associative arrays (hashes) efficiently.

header file

A file containing certain required definitions that you must include "ahead" of the rest of your program to do certain obscure operations. A C header file has a .h extension. A Perl header file has a .ph extension. See the require operator in Chapter 3, Functions. (Header files have been superseded by the module mechanism.)

here document

So called because of a similar construct in shells which pretends that the lines "right here" following the command are a separate file to be fed to the command, up to some trailing delimiter string. In Perl, however, it's just a fancy form of quoting.


A number in base sixteen, "hex" for short. The digits for ten through sixteen are customarily represented by the letters a through f. Hexadecimal constants in Perl start with 0x.

home directory

The directory you are placed into when you log in. On a UNIX system, the name is often placed into $ENV{HOME} or $ENV{LOGDIR} by the login program, but you can also find it with (getpwuid($<))[7].


The computer on which a program or other data resides.


Excessive pride, the sort of thing Zeus zaps you for. Also the quality that makes you write (and maintain) programs that other people won't want to say bad things about. Hence, the third great virtue of a programmer. See also laziness and impatience.


Short for "hash value," which refers to one of Perl's internal data types. An AV is a kind of SV.


A legally formed name for most anything in which a computer program might be interested. Many languages (including Perl) allow identifiers that start with a letter and contain letters and digits. Perl also counts the underscore character as a valid letter.


The anger you feel when the computer is being lazy. This makes you write programs that don't just react to your needs, but actually anticipate them. Or at least that pretend to. Hence, the second great virtue of a programmer. See also laziness and hubris.


Gain access to symbols that are exported from another module. See the use operator in Chapter 3, Functions.


To add one to something.


Formerly, the act of looking up a key in an index (like the phone book), but now merely the act of using any kind of key or position to find the corresponding value, even if no index is involved. Things have degenerated to the point that Perl's index function merely locates the position (index) of one string in another.

indirect object

In English grammar, a short noun phrase between a verb and its direct object indicating the beneficiary or recipient of the action. In Perl, print STDOUT `$foo\n`; can be understood as verb indirect-object object where STDOUT is the recipient of the print action, and "$foo" is the object being printed. Similarly, when invoking a class method, you might say:

% perl
sub Bob::give { shift; print 
   "Thanks for the @_!\n"; }
give Bob memories
Thanks for the memories!


When Randal says, "I don't know the answer... go ask Larry." Similarly, if something in a program isn't the answer, but indicates where the answer is, that's indirection. This can be done with symbolic or hard references.


What you get from your ancestors, genetically or otherwise. If you happen to be a class, your ancestors are called base classes and your descendants are called derived classes. See single inheritance and multiple inheritance.


Number with no fractional part; whole number.


The insertion of one piece of text somewhere in the middle of another piece of text. The inserted piece may derive from a variable or other indirect source.


Strictly speaking, a program that reads a second program and does what the second program says directly without turning the program into a different form first, which is what compilers do. Perl is not an interpreter by this definition, because it contains a kind of compiler that takes a program and turns it into a more executable form (syntax trees) within the Perl process itself, which the Perl run-time system then interprets.


The act of calling up a program, subroutine, or function to do what it's supposed to do.


Short for Inter-Process Communication. Sometimes a process just needs to talk to some other process.


A relationship between two objects in which one object is considered to be a more specific version of the other generic object: "A camel is a mammal." Since the generic object really only exists in a platonic sense, we usually add a little abstraction to the notion of objects and think of the relationship as being between a generic base class and a specific derived class. Oddly enough, platonic classes don't always have platonic relationships--see inheritance.


Doing something again and again and again and again and again and.... Usually this is done until you're loopy, which is why they call them loops.[3]

[3] We'd put in the usual joke referring you back to Iteration, but that trick has been iterated too often already, and is no longer funny. Look for the joke under Loop instead. Also look for a similar joke under Recursion, which is still funny at some level or other.


A special programming gizmo that keeps track for you of where you are in something that you're trying to iterate over. The foreach loop in Perl contains an iterator.


A special kind of data, such as your Social Security number, that can be used to locate other data. The other data may be considered the value associated with the key.


See reserved word.


A kind of key you can give to a statement so that you can talk about that statement elsewhere in the program.


The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful, and document what you wrote so you don't have to answer so many questions about it. Hence, the first great virtue of a programmer. Also hence, this book. See also impatience and hubris.

left shift

A bit shift that multiplies the number by some power of two.

lexical scoping

Looking at your Oxford English Dictionary through a microscope. (Also known as static scoping, because dictionaries don't change very fast.) Similarly, looking at variables that are stored in a private dictionary for each subroutine, which are visible only from their point of declaration down to the end of the block in which they are declared. --Syn. static scoping. --Ant. dynamic scoping. [< Gk]


A collection of procedures. In ancient days, referred to a collection of subroutines in a .pl file. In modern times, refers often to the entire collection of Perl modules on your system.


In UNIX, a sequence of zero or more non-newline characters terminated with a newline character. On non-UNIX machines, this is emulated even if the underlying operating system has different ideas.

line buffering

Used by a standard I/O output stream that flushes its buffer after every newline. Many standard I/O libraries automatically set this up on output that is going to the terminal.

line number

The number of lines read prior to this one, plus 1. Perl keeps a separate line number for each script or input file it opens. The current script line number is represented by _ _LINE_ _. The current input line number (for the file that was most recently read from via <>) is represented by the $. variable. Many error messages report both values, if available.


In UNIX, a name in a directory, representing a file. A given file can have multiple links to it. It's like having the same phone number listed in the phone directory under different names.


An ordered set of values.


A syntactic construct representing a comma-separated list of expressions, evaluated to produce a list value. Each expression in a LIST is evaluated in a list context.

list context

The situation in which an expression is expected by its surroundings (the code calling it) to return a list of values rather than a single value. Functions that want a LIST of arguments tell those arguments that they should produce a list value. See also context.

list operator

Generally, an operator that does something with a list of values. Specifically, those operators (such as print, unlink, and system) that do not require parentheses around their argument list.

list value

An unnamed list of scalar values that may be passed around within a program and passed to any function that provides a list context.


Often means "figurative", as in "I'm literally scared to death." More literally, a symbol in a programming language like a number or string that gives you an actual value instead of merely representing possible values like a variable.


From Swift: someone who eats boiled eggs little end first. Also used of computers that store the least significant byte of a word at a lower byte address than the most significant byte. Often considered superior to big-endian machines. See also big-endian.


Not meaning the same thing everywhere. A variable in Perl can be localized inside a block or a package. See scope.

logical operator

Symbols representing the concepts "and", "or", and "not".


A construct that performs something repeatedly, like a roller coaster. (Go to the next entry if you're tired of riding this one.) See loop.

loop control statement

Any statement within the body of a loop that can make a loop stop looping or skip an iteration. See the middle sentence of the previous entry. Generally you shouldn't try this on roller coasters without a parachute.

loop label

A kind of key or name attached to a loop so that loop control statements can talk about which loop they want to control.


Term used by language-lawyers for a location you can assign a new value to, such as a variable or an element of an array. The "l" is short for "left", as in the left side of an assignment, a typical place for lvalues.

magical increment

An increment operator that knows how to add 1 to alphanumeric strings as well as to numbers.

magical variables

Special variables that have side effects when you access them or assign to them. For example, in Perl, changing elements of the %ENV array also changes the corresponding environment variables that subprocesses will use. Reading the $! variable gives you the current UNIX error number or message.


A "page" from the UNIX manuals, typically accessed online via the man (1) command. A manpage contains a synopsis, a description, a list of bugs, and so on, and is typically longer than a page. There are manpages documenting commands, system calls, library functions, devices, protocols, files, and such.


The part of a floating-point number that gives the digits of the number without saying where the decimal point really belongs. See exponent.


See pattern matching.


A character that is not supposed to be treated normally. Which characters are to be treated specially as metacharacters varies greatly from context to context. Your shell will have certain metacharacters, double-quoted Perl strings have other metacharacters, and patterns have all the double-quote metacharacters plus some extra ones. In addition, people sometimes use this term to describe characters that have the eighth bit set.


A kind of action that an object can take if you direct it to.


The belief that "small is beautiful." Paradoxically, if you say something in a small language, it turns out big, and if you say it in a big language, it turns out small. Go figure.


In the context of the stat (2) system call, refers to the word holding the permissions and the type of the file.


A conditional or loop that you put after the statement instead of before, if you know what I mean.


A file that defines a package of (almost) the same name, which can either export symbols or function as an object class. The unit of reusability in Perl. See the use operator.


A divisor, when you're interested in the remainder instead of the quotient.

multi-dimensional array

An array with multiple subscripts for finding a single element. Perl does them with references--see Chapter 4, References and Nested Data Structures.

multiple inheritance

The features you got from your mother and father, mixed together unpredictably. (See also inheritance, and single inheritance.) In computer languages (including Perl), the notion that a given class may have multiple direct ancestors or base classes.


A domain of names. You needn't worry whether the names in one such domain have been used in another. See package.

network address

The most important attribute of a socket, like your telephone's telephone number.


A single character that represents the end of a line, with the ASCII value of 012 octal under UNIX (but 015 on a Mac), and represented by \n in Perl strings. For certain physical devices like terminals, this gets translated to a line feed and a carriage return.

null character

A character with the ASCII value of zero. It's used by C and some UNIX system calls to terminate strings, but Perl allows strings to contain a null.

null list

A list value with zero elements, represented in Perl by ().

null string

A string not containing any characters, not to be confused with a string containing a null character, which has a positive length.

numeric context

The situation in which an expression is expected by its surroundings (the code calling it) to return a number. See also context and string context.


Half a byte, equivalent to one hexadecimal digit.


Something that "knows" what kind of thing it is, and what it can do because of what kind of thing it is. Your program can request an object to do things, but the object gets to decide whether it wants to do it or not.


A number in base eight. Only the digits zero through seven are allowed. Octal constants in Perl start with zero, as in 013.


How many things you have to skip over when moving from the beginning of a string or array to a specific position within it. Thus, the minimum offset is zero, not one, because you don't skip anything to get to the first item.


You, after you dial the operator on your phone. Or, an expression that gives a value that an operator operates on. See also precedence.

operating system

A special program that runs on the bare machine and hides the gory details of managing processes and devices. It is usually used in a looser sense to indicate a particular culture of programming. The loose sense can be used at varying levels of specificity. At one extreme, you might say that all versions of UNIX and UNIX-lookalikes are the same operating system (upsetting many people, especially some lawyers). At the other extreme, this particular version of this particular vendor's operating system is different than any other version of this or any other vendor's operating system. Perl is much more portable across operating systems than many other languages. See also architecture.


A function, generally one that is built into a language, often with a special syntax or symbol. A given operator may have specific expectations about what types of data you give as its arguments (operands) and what type of data you want back from it.

operator overloading

A kind of overloading that you can do on the built-in operators to make them work (syntactically) on objects as if they were ordinary scalar values, but with the actual semantics supplied by the object class. This is set up with the overload pragma--see Chapter 7, The Standard Perl Library.


See switches.


Giving additional meanings to a symbol or construct. Actually, all languages do overloading to one extent or another, since people are good at figuring out things from context. If you look in your dictionary, you will find that the meaning of the word "single" is not single.


Hiding or invalidating some other definition of the same name. (Not to be confused with overloading, which only adds definitions.) To confuse the issue further, we use the word with two overloaded definitions: to describe how you can define your own subroutine that hides a built-in function of the same name, and also to describe how you can define a replacement method in a derived class that hides a base class 's method of the same name. You'll find both of these usages in Chapter 5, Packages, Modules, and Object Classes.


The one user (apart from the superuser) who has absolute control over a file. A file may also have a group of users that may exercise joint ownership if the real owner permits them. See permission flags.


A quantity of code that values its privacy, and tries to keep other code from trespassing upon its namespace by fencing all of its private belongings (variables and subroutines) into its own area. A variable or subroutine mentioned in the package belongs only to that package, even if there's another variable or subroutine with an identical name in some other package.

package local

A variable or subroutine belonging to a package and not visible to anyone else. At least, not without peeking. See namespace.


See argument.


The subtle but sometimes brutal art of attempting to turn your possibly malformed program into a valid syntax tree.


The list of directories the system looks in to find a program you want to execute. The list is stored as one of your environment variables, accessible in Perl as $ENV{PATH}.


A fully qualified filename such as /usr/bin/perl or C:\my_apps\perl.exe. Sometimes confused with PATH.

pattern matching

Taking a pattern, expressed as a regular expression, and trying the pattern various ways on a string to see if there's any way to make it fit. Often used to pick interesting tidbits out of a file.

permission flags

Bits that the owner of a file sets or unsets in order to allow or disallow access to other people. These flags are part of the mode word returned by the stat operator when you ask about a file. On UNIX systems you can check the ls (1) manpage for more information about the permission flags.


What you get when you do Perl++ twice. Increment it only once, and your hair curls. Increment it three times, and you get a tasty beverage that isn't Java. See also slice.


A direct connection that carries the output of one process to the input of another without the necessity of an intermediate temporary file. Once the pipe is set up, the two processes in question can mostly read and write as if they were talking to a normal file.


A series of processes all in a row, linked by pipes, where each passes its output to the next.


A variable in a language like C that contains the exact memory location of some other item. Perl handles pointers internally so you don't have to worry about them. Instead, you just use symbolic pointers in the form of keys and variable names, or hard references, which aren't pointers (but act like pointers, and do in fact contain pointers).


The part of the address of a TCP or UDP socket that directs packets to the correct process after finding the right machine, something like the phone extension number you give when you reach the company operator.


A library module whose practical hints and suggestions are received (and possibly ignored) by the compiler. [< Gr]


The rules of conduct that, in the absence of other guidance, determine what should happen first (i.e., in the absence of parentheses, you always do multiplication before addition).


What some other helper process did to transform the incoming data into a form more suitable for the current process. Often done with an incoming pipe. See also C preprocessor.


A subroutine.


An instance of a running program. Under multi-tasking systems like UNIX, two or more separate processes could be running the same program independently at the same time--in fact, the fork function is designed to bring about this happy state of affairs. Under other operating systems processes are sometimes called "tasks" or "jobs".


In networking, an agreed-upon way of sending messages back and forth so that neither correspondent will get too confused.

pseudo literal

An operator that looks something like a literal, such as the output-grabbing operator, `command`.

pseudo terminal

A thing that looks like an ordinary terminal to the computer, but instead of being attached to a real terminal, is really attached to another computer program, which is doing the pseudotyping.

public domain

Something not owned by anybody. Perl is copyrighted, and is thus not in the public domain--it's just freely available and freely redistributable.


A "pointer value", which is Perl Internals Talk for a char*.


Possessing an explicit package name. The symbol $ex::loser is qualified; $loser is unqualified.


With regard to files, one that has the proper permission bit set to let you access the file. With regard to computer programs, one that's well enough written that someone can come back later and have a chance of figuring out what it's trying to do. Who knows, you might even have to come back and figure out your own program.


A set of related data values in a file or stream, often associated with a unique key field. In UNIX, often commensurate with a line, or a blank-line-delimited set of lines (a "paragraph"). Each line of the /etc/passwd file is a record, keyed on login name, containing information about that user.


The art of defining something (at least partly) in terms of itself by means of recursion, which is a naughty no-no in dictionaries.


A place you look to find a pointer to information stored somewhere else. (See indirection.) References come in two flavors, symbolic references, and hard references.

regular expression

A single entity with various interpretations, like an elephant. To a computer scientist, it's a grammar for a little language in which some strings are legal and others aren't. To normal people, it's a pattern that you can use to find what you're looking for when it varies from case to case. Example of a regular expression:

/Oh s.*t./

This pattern will match strings like `Oh say can you see by the dawn's early light,` and `Oh sit!`. See the section "Regular Expressions" in Chapter 2, The Gory Details.

regular file

A file that's not a directory, a device, a named pipe or socket, or a symbolic link. Perl uses the -f file test operator to identify regular files.


Jargon used by relational database folks to mean a file--albeit a particular sort of file, tabular in form, in which all the tuples (records) are of the same kind, each containing the same domains (keys) and ranges (fields). The UNIX /etc/passwd file is a relation keyed on login name. It's called a relation because it relates keys and fields in much the same way as an hash associates keys and values.

relational operator

An operator that says whether a particular ordering relationship is true about a pair of operands. Perl has both numeric and string relational operators. See collating sequence.

reserved words

A word with a specific, built-in meaning to a compiler, such as if or delete. In many languages (not Perl) it's illegal to use reserved words to name anything else. (Which is why they're reserved, after all.) In Perl, you just can't use them to name labels or filehandles. Also called "keywords".

return value

The value produced by a subroutine or expression when evaluated. In Perl, a return value may be either a list or a scalar value. The subroutine call piglatin('bingo') returns the value "ingobay".

right shift

A bit shift that divides a number by some power of two.


The time when Perl is actually doing what your script says to do, as opposed to the earlier period of time when it was trying to figure out whether what you said made any sense whatsoever. See also compile-time.

run-time pattern

A pattern that contains one or more variables to be interpolated before parsing the pattern as a regular expression, and that therefore cannot be analyzed at compile time, but must be re-analyzed each time the pattern match operator is evaluated. Run-time patterns are useful but expensive.


A value that you might find on the right side of an assignment. See also lvalue.


A simple value, such as a number or string.

scalar context

The situation in which an expression is expected by its surroundings (the code calling it) to return a single value rather than a list of values. See also context and list context. A scalar context sometimes imposes additional constraints on the return value--see string context and numeric context. Sometimes we talk about a Boolean context inside conditionals, but this imposes no additional constraints, since any scalar value, whether numeric or string, is already true or false.

scalar literal

A number or quoted string--an actual value in the text of your program, as opposed to a variable.

scalar value

A value that happens to be a scalar as opposed to a list.

scalar variable

A variable prefixed with $ that holds a single value.


How far away you can see a variable from, looking through one. Perl has two visibility mechanisms: it does dynamic scoping of local variables, meaning that the rest of the block, and any subroutines that are called by the rest of the block, can see the variables that are local to the block. Perl does lexical scoping of my variables, meaning that the rest of the block can see the variable, but other subroutines called by the block cannot see the variable.


A text file that is a program intended to be executed directly rather than compiled to another form of file before execution.


A venerable stream editor from which Perl derives some of its ideas.


In networking, a process that either advertises a service or just hangs around at a known location and waits for clients who need service to get in touch with it.


Something you do for someone else to make them happy, like giving them the time of day (or of their life). On some UNIX machines, well-known services are listed by the getservent function.


Same as setuid, only having to do with giving away group privileges.


Said of a program that runs with the privileges of its owner rather than (as is usually the case) the privileges of whoever is running it. Also describes the bit in the mode word (permission flags) that implements the feature. This bit must be explicitly set by the owner to implement this feature, and the program must be written not to give away more privileges than it ought.


A command-line interpreter. The program that interactively gives you a prompt, accepts one or more lines of input, and executes the programs you mentioned, feeding each of them their proper arguments and input data. Shells can also execute scripts containing such commands. Under the UNIX operating system, typical shells are the Bourne shell (/bin/sh), the C shell (/bin/csh), and the Korn shell (/bin/ksh). Perl is not strictly a shell because it's not interactive (although Perl programs can be interactive).

side effects

Something extra that happens when you evaluate an expression. Nowadays it can refer to almost anything. For example, evaluating a simple assignment statement typically has the "side effect" of assigning a value to a variable. (And you thought assigning the value was your primary intent in the first place!) Likewise, assigning a value to the special variable $| has the side effect of forcing a flush after every write or print on the currently selected filehandle.

signal handler

A subroutine that, instead of being content to be called in the normal fashion, sits around waiting for a bolt out of the blue before it will deign to execute. Under UNIX, bolts out of the blue are called signals, and you send them with a kill command.

single inheritance

The features you got from your mother, if she told you you don't have a father. (See also inheritance, and multiple inheritance.) In computer languages, the notion that classes reproduce asexually, so that a given class can only have one direct ancestor or base class. Perl enforces no such restriction.


A selection of array elements.


An endpoint for network communication between two processes, that works much like a telephone. The most important thing about a socket is its network address (like a phone number). Different kinds of sockets have different kinds of addresses--some look like filenames, and some don't.

soft reference

See symbolic reference.

standard error

The default output stream for making nasty remarks that don't belong in standard output. Represented within a Perl program by the filehandle STDERR. You can use this stream explicitly, but the operators die and warn write to your standard error stream automatically.

standard I/O

A standard C library for doing buffered input and output to the operating system. (The "standard" of standard I/O is only marginally related to the "standard" of standard input and output.) In general, Perl relies on whatever implementation of standard I/O a given operating system supplies, so the buffering characteristics of a Perl program on one machine may not exactly match those on another machine. Normally this only influences efficiency, not semantics. If your standard I/O package is doing block buffering and you want it to flush the buffer more often, just set the $| variable to a nonzero value.

standard input

The default input stream for your program, which if possible shouldn't care where its data is coming from. Represented within a Perl program by the filehandle STDIN.

standard output

The default output stream for your program, which if possible shouldn't care where its data is going. Represented within a Perl program by the filehandle STDOUT.

stat structure

A special internal buffer in which Perl keeps the information about the last file you requested information on.


A command to the computer about what to do next, like a step in a recipe: "Add marmalade to batter and mix until mixed." Not to be confused with a declaration, which doesn't tell the computer to do anything, but just to learn something.


Varying slowly, compared to something else. (Unfortunately, everything is relatively stable compared to something else, except for certain elementary particles, and we're not so sure about them.) In computers, where things are supposed to vary rapidly, "static" has a derogatory connotation, indicating a slightly dysfunctional variable, subroutine, or method. In Perl culture, the word is considered to be politically incorrect.

static method

See class method.

static scoping

Same as lexical scoping.


The value returned to the parent process when one of its child processes dies. This value is placed in the special variable $?. Its upper eight bits are the exit status of the defunct process, and its lower eight bits identify the signal (if any) that the process died from. On UNIX systems, this status value is the same as the status word returned by wait (2). See system in Chapter 3, Functions.


See standard error.


See standard input.


See standard I/O.


See standard output.


A sequence of characters such as "He said !@#*&%@#*?\n." A string does not have to be entirely printable.

string context

The situation in which an expression is expected by its surroundings (the code calling it) to return a string. See also context and numeric context.


C keyword introducing a structure definition or name.


See data structure.


See derived class.


A named piece of program that can be invoked from elsewhere in the program in order to accomplish some sub-goal of the program. A subroutine is often parameterized to accomplish different but related things depending on its input arguments. If the subroutine returns a meaningful value, it is also called a function.


A value that indicates the position of a particular array element in an array.


A portion of a string, starting at a certain character position (offset), and proceeding for a certain number of characters.


See base class.


The person whom the operating system will let do almost anything. Typically your system administrator or someone pretending to be your system administrator. On UNIX systems, the root user.


Short for "scalar value". But within the Perl interpreter every thingy is treated as a kind of SV, in an object-oriented sort of way. Every value inside Perl is passed around as an SV* pointer in C. The SV struct knows its own "thingy type", and the code is smart enough (we hope) not to try to call a hash function on a subroutine.


An option you give on a command line to influence the way your program works. In UNIX, these are usually introduced with a minus sign. The word is also used as a nickname for a switch statement.

switch clustering

The combining of multiple command line switches -a -b -c into one switch -abc. In Perl, any switch with an additional argument must be the last switch in a cluster.

switch statement

A program construct that lets you evaluate an expression and, based on the expression's value, do a multi-way branch to the appropriate piece of code for that value. Also called a "case structure", after the similar Pascal construct.

symbol table

Where a compiler remembers symbols. A program like Perl must somehow remember all the names of all the variables, filehandles, and subroutines you've used. It does this by placing the names in a symbol table, which is implemented in Perl using a hash table. There is a separate symbol table for each package, to give each package its own namespace.

symbolic debugger

A program that lets you step through the execution of your program, stopping or printing things out here and there to see if anything has gone wrong, and if so, what. The "symbolic" part just means that you can talk to the debugger using the same symbols in which your program is written.

symbolic link

An alternate filename that points to the real filename. Whenever the operating system is trying to parse a pathname containing a symbolic link, it merely substitutes the real name and continues parsing.

symbolic reference

A variable whose value is the name of another variable or subroutine. By dereferencing the first variable, you can get at the second one.


From Greek, "with-arrangement". How things (particularly symbols) are put together with each other.

syntax tree

An internal representation of your program wherein lower-level constructs dangle off the higher-level constructs enclosing them.

system call

A subroutine call directly to the operating system. Many of the important subroutines and functions you use aren't direct system calls, but are built up in one or more layers above the system call level. In general, Perl users don't need to worry about the distinction.


Said of data that might be derived from the grubby hands of a user, and thus unsafe for a secure program to rely on. Perl does taint checks if you run a setuid program or use the -T switch.


Short for Transmission Control Protocol. A protocol wrapped around the Internet Protocol to make an unreliable packet transmission mechanism appear to the application program to be a reliable stream of bytes. (Well, usually.)


Normally, a string or file containing primarily printable characters. The word has been usurped in some UNIX circles to mean the portion of your process that contains machine code to be executed.


Something sort of like an object, that you may or may not know the name of, but that you can refer to with circumlocutions like "that hangy-down thingy that dangles in the back of your throat". Similarly in Perl, a value that is sort of like an object, that you may or may not know the name of, but that you can refer to via references from which the thingy dangles, metaphorically speaking. Specifically, the sort of value that your reference points to when you create a reference to a variable. See anonymous, hard reference, and object, not necessarily in that order.


An instance of running a program, but lighter weight than a process, in that a process could have multiple threads running around in it, all sharing the same process's resources. (If you're a dragonrider, see Pern.)


The bond between a magical variable and its implementation class. See the tie function in Chapters 3 and 5.


Splitting up a program text into its separate words and symbols, each of which is called a token. Also known as "lexing", in which case you get "lexemes" instead of tokens.

toolbox approach

The notion that, with a complete set of simple tools that work well together, you can build almost anything you want. Which is fine if you're assembling a tricycle, but if you're building a defranishizing comboflux, you really want your own machine shop to build special tools in. Perl is sort of a machine shop.


See false. (And hold it up to a mirror for the secret message.)


In the lingo of relational databases, a record or line containing fields. See relation.


See data type.

type casting

Converting data explicitly from one type to another. C permits this. Perl does not need it.


Used of a single identifier, prefaced with * (for example, *name), to stand for any or all of $name, @name, %name, &name, or just name. How you use it determines whether it is interpreted as all of those, or only one of them. See "Typeglobs and Filehandles" in Chapter 2, The Gory Details.


A User ID. Often used in the context of file ownership.

unary operator

An operator with only one operand, like ! or chdir. Unary operators are usually prefix operators, that is, they precede their operand. The ++ and - - operators can be either prefix or postfix. (Of course, that does change their meaning.)


Nobody has ever given this a reasonable definition. See also defined.


A very large and constantly evolving language with several alternate and largely incompatible syntaxes, in which anyone can define anything any way they choose, and usually do. Speakers of this language think it's easy to learn because it's so easily twisted to one's own ends, but dialectical differences make tribal intercommunication nearly impossible, and travelers are often reduced to a pidgin-like subset of the language. To be universally understood, a UNIX shell programmer must spend years of study in the art. Many have abandoned this discipline and now communicate via an Esperanto-like language called Perl. In ancient times UNIX was also used to refer to some code that a couple of people at Bell Labs wrote to make use of a PDP-7 computer that wasn't doing much of anything else at the time.


See qualified.


This is hard to define. It's something like real data--the actual numbers and strings that wander around in your program. But we don't really need to define it. If you didn't know a value when you see it, you wouldn't have this book. :-)


A named storage location that can hold any of various values, as your program sees fit.

variable interpolation

See interpolation.


Mathematical jargon for a list of scalar values.


A message printed to the STDERR stream to the effect that something might be wrong but it isn't worth blowing up over. See the warn operator in Chapter 3, Functions.


A character that moves your cursor around but doesn't otherwise put anything on your screen. Typically refers to any of the following: space, tab, line feed, carriage return, form feed, or vertical tab.


In normal "computerese", the piece of data of the size most efficiently dealt with by your computer, typically 32 bits or so, give or take a few powers of two. In UNIX culture, it more often refers to an alphanumeric identifier, or to a string of non-whitespace characters bounded by whitespace or line boundaries.

working directory

Your current directory, from which relative pathnames are interpreted by the operating system. The operating system knows your current directory because you told it with a chdir, or because you started out in the same place where your parent process was when you were born.


A program that runs some other program for you, modifying some of its input or output to better suit your purposes. More generally, just about anything that wraps things up. And that just about wraps things up, except for the excess.


An extraordinarily exported, expeditiously excellent, expressly eXternal Subroutine, executed in existing C or C++, or in an exciting new extension language called (exasperatingly) XS. Examine Chapter 6, Social Engineering, for the exact explanation. Exeunt.

Previous Home  
Diagnostic Messages Book Index  

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell
Hosted by uCoz