Name
formline
Synopsis
formline picture, variables
Internal function used by formats, although you may
also call it. It formats a list of values
(variables
) according to the contents
of picture
, placing the output into the
format output accumulator, $^A
.
When a write
is done, the
contents of $^A
are written to
a filehandle, but you can also read $^A
yourself and set $^A
back to “”. Note that a format
typically does one formline
per
line of form, but the formline
function itself doesn’t care how many newlines are embedded in the
picture
. This means that the ~
and ~~
tokens will treat the entire
picture
as a single line. Thus, you may
need to use multiple formlines to implement a single-record
format, such as the format compiler.
Be careful if you put double quotes around the picture,
since an @
character may be
taken to mean the beginning of an array name. formline
always returns true. See Chapter 4 for more
information.
Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.