Output a string with a trailing newline.
The say function works exactly like print, but automatically appends a newline character to the output. It is available in Perl 5.10 and later, and must be enabled with use feature 'say' or use v5.10.
Like print, say outputs to the currently selected filehandle (usually STDOUT) unless another filehandle is specified. It is particularly convenient for quick debugging output and for scripts that produce line-oriented output.
say respects the output record separator $\ and the list separator $, in the same way print does, with the newline added after any output record separator.
| Name | Description | Optional |
|---|---|---|
FILEHANDLE |
The filehandle to print to. Defaults to STDOUT if omitted. | Yes |
LIST |
The strings to print. If omitted, prints $_. | Yes |
use feature 'say';
say "Hello, World!";
say for @items; # prints each item on its own line