- publishing free software manuals
Perl Language Reference Manual
by Larry Wall and others
Paperback (6"x9"), 724 pages
ISBN 9781906966027
RRP £29.95 ($39.95)

Sales of this book support The Perl Foundation! Get a printed copy>>>

29.19 S

scalar
A simple, singular value; a number, string, or reference.
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.
scope
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.
scratchpad
The area in which a particular invocation of a particular file or subroutine keeps some of its temporary values, including any lexically scoped variables.
script
A text file that is a program intended to be executed directly rather than compiled to another form of file before execution. Also, in the context of Unicode, a writing system for a particular language or group of languages, such as Greek, Bengali, or Klingon.
script kiddie
A cracker who is not a hacker, but knows just enough to run canned scripts. A cargo-cult programmer.
sed
A venerable Stream EDitor from which Perl derives some of its ideas.
semaphore
A fancy kind of interlock that prevents multiple threads or processes from using up the same resources simultaneously.
separator
A character or string that keeps two surrounding strings from being confused with each other. The split ( ) function works on separators. Not to be confused with delimiters or terminators. The "or" in the previous sentence separated the two alternatives.
serialization
Putting a fancy data structure into linear order so that it can be stored as a string in a disk file or database or sent through a pipe. Also called marshalling.
server
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.
service
Something you do for someone else to make them happy, like giving them the time of day (or of their life). On some machines, well-known services are listed by the getservent ( ) function.
setgid
Same as setuid, only having to do with giving away group privileges.
setuid
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 bits) that controls the feature. This bit must be explicitly set by the owner to enable this feature, and the program must be carefully written not to give away more privileges than it ought to.
shared memory
A piece of memory accessible by two different processes who otherwise would not see each other's memory.
shebang
Irish for the whole McGillicuddy. In Perl culture, a portmanteau of "sharp" and "bang", meaning the #! sequence that tells the system where to find the interpreter.
shell
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 Unix, typical shells include 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 $| ($AUTOFLUSH) has the side effect of forcing a flush after every write ( ) or print ( ) on the currently selected filehandle.
signal
A bolt out of the blue; that is, an event triggered by the operating system, probably when you're least expecting it.
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 Perl, bolts out of the blue are called signals, and you send them with the kill ( ) built-in. See and 20.1.
single inheritance
The features you got from your mother, if she told you that 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 supplies no such restriction, though you may certainly program Perl that way if you like.
slice
A selection of any number of elements from a list, array, or hash.
slurp
To read an entire file into a string in one operation.
socket
An endpoint for network communication among multiple processes that works much like a telephone or a post office box. 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.
source filter
A special kind of module that does preprocessing on your script just before it gets to the tokener.
stack
A device you can put things on the top of, and later take them back off in the opposite order in which you put them on. See LIFO.
standard
Included in the official Perl distribution, as in a standard module, a standard tool, or a standard Perl manpage.
standard error
The default output stream for 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 die ( ) and warn ( ) built-ins 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 true 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 spot in which Perl keeps the information about the last file on which you requested information.
statement
A command to the computer about what to do next, like a step in a recipe: "Add marmalade to batter and mix until mixed." A statement is distinguished from a declaration, which doesn't tell the computer to do anything, but just to learn something.
statement modifier
A conditional or loop that you put after the statement instead of before, if you know what we mean.
static
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 politely avoided.
static method
No such thing. See class method.
static scoping
No such thing. See lexical scoping.
static variable
No such thing. Just use a lexical variable in a scope larger than your subroutine.
status
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 .
STDERR
See standard error.
STDIN
See standard input.
STDIO
See standard I/O.
STDOUT
See standard output.
stream
A flow of data into or out of a process as a steady sequence of bytes or characters, without the appearance of being broken up into packets. This is a kind of interface--the underlying implementation may well break your data up into separate packets for delivery, but this is hidden from you.
string
A sequence of characters such as "He said !@#*&%@#*?!". 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.
stringification
The process of producing a string representation of an abstract object.
struct
C keyword introducing a structure definition or name.
structure
See data structure.
subclass
See derived class.
subpattern
A component of a regular expression pattern.
subroutine
A named or otherwise accessible 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.
subscript
A value that indicates the position of a particular array element in an array.
substitution
Changing parts of a string via the s/// operator. (We avoid use of this term to mean variable interpolation.)
substring
A portion of a string, starting at a certain character position (offset) and proceeding for a certain number of characters.
superclass
See base class.
superuser
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. On Windows systems, usually the Administrator user.
SV
Short for "scalar value". But within the Perl interpreter every referent is treated as a member of a class derived from SV, in an object-oriented sort of way. Every value inside Perl is passed around as a C language SV* pointer. The SV struct knows its own "referent type", and the code is smart enough (we hope) not to try to call a hash function on a subroutine.
switch
An option you give on a command line to influence the way your program works, usually introduced with a minus sign. The word is also used as a nickname for a switch statement.
switch cluster
The combination of multiple command-line switches (e.g., -a -b -c) into one switch (e.g., -abc). Any switch with an additional argument must be the last switch in a cluster.
switch statement
A program technique that lets you evaluate an expression and then, based on the value of the expression, do a multiway branch to the appropriate piece of code for that value. Also called a "case structure", named after the similar Pascal construct. Most switch statements in Perl are spelled for. See 4.10 and 4.11.
symbol
Generally, any token or metasymbol. Often used more specifically to mean the sort of name you might find in a symbol table.
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 whether anything has gone wrong, and if so, what. The "symbolic" part just means that you can talk to the debugger using the same symbols with which your program is written.
symbolic link
An alternate filename that points to the real filename, which in turn points to the real file. Whenever the operating system is trying to parse a pathname containing a symbolic link, it merely substitutes the new 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. Symbolic references are illegal under use strict 'refs' ("strict refs" (strict) in the Perl Library Reference Manual (Volume 1)).
synchronous
Programming in which the orderly sequence of events can be determined; that is, when things happen one after the other, not at the same time.
syntactic sugar
An alternative way of writing something more easily; a shortcut.
syntax
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.
syscall
A function 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 programmers don't need to worry about the distinction. However, if you do happen to know which Perl functions are really syscalls, you can predict which of these will set the $! ($ERRNO) variable on failure. Unfortunately, beginning programmers often confusingly employ the term "system call" to mean what happens when you call the Perl system ( ) function, which actually involves many syscalls. To avoid any confusion, we nearly always use say "syscall" for something you could call indirectly via Perl's syscall ( ) function, and never for something you would call with Perl's system ( ) function.
ISBN 9781906966027Perl Language Reference ManualSee the print edition