in reply to blocks and using braces around filehandles with print
print $fh LIST;
and
print { $fh } LIST;
are equivalent.
The curlies are required when dealing with more complex expressions for the file handle.
>perl -e"my @h = ( \*STDOUT ); print $h[$_] qq{foo!\n} for 0..$#h" syntax error at -e line 1, near "] qq{foo!\n}" Execution of -e aborted due to compilation errors. >perl -e"my @h = ( \*STDOUT ); print { $h[$_] } qq{foo!\n} for 0..$#h" foo!
|
|---|