Webmaster in a Nutshell

Previous Chapter 15
Perl Quick Reference
Next
 

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.


Previous Home Next
Input/Output Book Index Directory Reading Routines

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell