Contents / Previous / Next


Formats (More info:I)

Formats are defined as follows:

FORMLIST pictures the lines, and contains the arguments which will give values to the fields in the lines. NAME defaults to STDOUT if omitted.

Picture fields are:

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.
Use $- to zero to force a page break on the next write.

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 (same name).
Example: $me = "fred"; $you = "Mary"; format LETTER = Dear @<<<<, $you; I am very sorry, but I cannot help you with your problem. Sincerely, @<<<<< $me . open LETTER , ">letter.txt"; write ( LETTER ); close LETTER; Output:
Dear Mary ,

I am very sorry, but I cannot help
you with your problem.

Sincerely,
  fred