From the docs for print:
Note that if you're storing FILEHANDLEs in an array, or if you're using any other expression more complex than a scalar variable to retrieve it, you will have to use a block returning the filehandle value instead:
I believe the braces define a block of code, and I believe $_[0] qualifies as an 'expression more complex than a scalar variable'. If you refactor the sub like this, then the braces around the FILEHANDLE are not needed:
use warnings; use strict;
sub print_to {
my ($fh, $str) = @_;
print $fh $str;
}
print_to (*STDOUT, "test stdout");
print_to (*STDERR, "test stderr");
| [reply] [Watch: Dir/Any] [d/l] [select] |