Perl Programming/Keywords/write
Appearance
The write keyword
[edit | edit source]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 | edit source] write FILEHANDLE
write EXPRESSION
write