Name
Synopsis
print [filehandle]list
Prints a string or a comma-separated list of strings
to the specified filehandle. If no
filehandle is given, the function prints to the currently open
filehandle (STDOUT initially). The function returns 1 if successful, 0 otherwise.
filehandlemay be a scalar variable name
(unsubscripted), in which case the variable contains either the
name of the actual filehandle or a reference to a filehandle
object from one of the object-oriented filehandle packages.
filehandle may also be a block that
returns either kind of value:
print { $OK ? "STDOUT" : "STDERR" } "stuff\n";
print { $iohandle[$i] } "stuff\n";If list is also omitted, $_ is printed. Note that because
print takes a list, anything in
the list is evaluated in list
context.
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