=over =item print FILEHANDLE LIST X =item print FILEHANDLE =item print LIST =item print Prints a string or a list of strings. Returns true if successful. FILEHANDLE may be a scalar variable containing the name of or a reference to the filehandle, thus introducing one level of indirection. (NOTE: If FILEHANDLE is a variable and the next token is a term, it may be misinterpreted as an operator unless you interpose a C<+> or put parentheses around the arguments.) If FILEHANDLE is omitted, prints to the last selected (see L|/select FILEHANDLE>) output handle. If LIST is omitted, prints L|perlvar/$_> to the currently selected output handle. To use FILEHANDLE alone to print the content of L|perlvar/$_> to it, you must use a bareword filehandle like C, not an indirect one like C<$fh>. To set the default output handle to something other than STDOUT, use the select operation. The current value of L|perlvar/$,> (if any) is printed between each LIST item. The current value of L|perlvar/$\> (if any) is printed after the entire LIST has been printed. Because print takes a LIST, anything in the LIST is evaluated in list context, including any subroutines whose return lists you pass to L|/print FILEHANDLE LIST>. Be careful not to follow the print keyword with a left parenthesis unless you want the corresponding right parenthesis to terminate the arguments to the print; put parentheses around all arguments (or interpose a C<+>, but that doesn't look as good). If you're storing handles in an array or hash, or in general whenever you're using any expression more complex than a bareword handle or a plain, unsubscripted scalar variable to retrieve it, you will have to use a block returning the filehandle value instead, in which case the LIST may not be omitted: print { $files[$i] } "stuff\n"; print { $OK ? *STDOUT : *STDERR } "stuff\n"; Printing to a closed pipe or socket will generate a SIGPIPE signal. See L for more on signal handling. =back