Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

print

Outputs a list of values to a filehandle.

Pops values from the stack and writes them to the target filehandle. When the STACKED flag is set, the first value after the mark is the filehandle; otherwise, STDOUT is used.

The output field separator $, ($OFS) is inserted between values, and the output record separator $\ ($ORS) is appended after all values. For say (which shares this implementation), a newline is always appended after the output.

Supports Gv (typeglob), bareword string, and lexical (integer ID) filehandle forms. In-memory filehandles (open my $fh, '>', \$buf) write to the backing buffer.

Returns 1 on success (Perl convention).

Synopsis

print "hello world\n";
print STDERR "error message\n";
print $fh @data;
print @array;                # uses $, and $\

See Also

say, printf, write, perlvar