Perl Programming/Keywords/write

Previous: while Keywords Next: xor

The write keyword edit

The write function writes a formatted (multi-line) record to the FILEHANDLE with the associated file format that has the same name per default of the filehandle. This name can be modified by assigning the new name to the $~ variable.

If the contents to be written are more than the page can hold, a form feed, and a special top-of-page format is used to format the new page header before the record is written that has by default the filehandle with "_TOP" appended, or "top" in the current package. But this name can be added to the $^ variable.

Without an FILEHANDLE, it goes to the standard default output channel. This is normally STDOUT, but can be modified by the select operator.

write is unfortunately not the opposite of read!

Syntax edit

  write FILEHANDLE
  write EXPRESSION
  write

See also edit

Previous: while Keywords Next: xor