http://qs321.pair.com?node_id=378504

Having just tried this for the first time, I found the results... er, instructive. I'm sure there's an explanation for this somewhere in the man pages, but I haven't found it yet. The issue centers on how Perl parses the first token following "print".
#!/usr/bin/perl use strict; use IO::File; # though you don't have to in 5.8, of course my %fh_hash; for ( qw/foo bar baz/ ) { $fh_hash{$_} = new IO::File; $fh_hash{$_}->open( "> $_.txt" ) or die "$_.txt: caramba: $!"; # the next line, if uncommented, will produce a syntax error: # print $fh_hash{$_} "testing output to $_\n"; # but doing it this way is okay, and it works: print {$fh_hash{$_}} "testing output to $_\n"; }