[Chapter 15] 15.18 Formats
Author: Stephen Spainhour and Valerie Quercia
Date: Fri Aug 29 18:13:23 1997

#

| Chapter 15 Perl Quick Reference |

## 15.18 Formats

`formline` picture, list

  Formats list according to picture and accumulates the result into $^A.

`write` [ filehandle ]

  Writes a formatted record to the specified file, using the format associated with that file.

Formats are defined as follows:

    format [ name ] =
    formlist
    .

formlist pictures the lines, and contains the arguments that will give values to the fields in the lines. name defaults to STDOUT if omitted.

Picture fields are:

| @<<<... | Left-adjusted field, repeat the < to denote the desired width
| @>>>... | Right-adjusted field
| @| | |... | Centered field
| @#.##... | Numeric format with implied decimal point
| @* | A multiline field

Use ^ instead of @ for multiline block filling.

Use ~ at the beginning of a line to suppress unwanted empty lines.

Use ~~ at the beginning of a line to have this format line repeated until all fields are exhausted.

Set $- to zero to force a page break on the next `write`.

See also $^, $~, $^A, $^F, $-, and $= in Special Variables.

Input/Output |  | Directory Reading Routines