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.
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.
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.
A quaint, archaic expression used by people who have read the first edition of this book. Nowadays called list context.
Strictly, a comma-separated, parenthesized LIST of scalar literals. Used loosely to refer to any parenthesized LIST even if it contains variables or expressions.
Another archaic phrase. See list value.
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.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
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.
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.)
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.
See working directory.
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.
A bare, single statement, without any braces, hanging off an if or while conditional. C allows them. Perl doesn't.
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.
The process of extracting only the most interesting tidbits because the boss can't read fast enough.
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.
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.
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".
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.
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.
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.
The way a program responds to an error. The exception handling mechanism in Perl is the eval construct.
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.)
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.
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.
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.
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.
A "wildcard" match on filenames.
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.
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.
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.
Means you don't have to pay money to get it, but the copyright on it may still belong to someone else (like Larry).
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).
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.
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.)
A method used internally by Perl for implementing associative arrays (hashes) efficiently.
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.)
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.
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.
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
^D
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