Chapter 27. Functions
This chapter describes the built-in Perl functions in alphabetical
order[233] for convenient reference. Each function description begins with a
brief summary of the syntax for that function. Parameter names like
THIS represent placeholders for actual
expressions, and the text following the syntax summary will describe the
semantics of supplying (or omitting) the actual arguments.
You can think of functions as terms in an expression, along with literals and variables. Or you can think of them as prefix operators that process the arguments after them. We call them operators half the time anyway.
Some of these operators, er, functions take a
LIST as an argument. Elements of the
LIST should be separated by commas (or by
=>, which is just a funny kind of
comma). The elements of the LIST are evaluated in
list context, so each element will return either a scalar or a list value,
depending on its sensitivity to list context. Each returned value, whether
scalar or list, will be interpolated as part of the overall sequence of
scalar values. That is, all the lists get flattened into one list. From the
point of view of the function receiving the arguments, the overall argument
LIST is always a single-dimensional list value.
(To interpolate an array as a single element, you must explicitly create and
interpolate a reference to the array instead.)
Predefined Perl functions may be used either with or without parentheses around their arguments; the syntax summaries in this chapter ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access