in reply to IO::File handle and printf

As an alternative to what Anon recommends above, you can try putting the handle in brackets:

printf({ $fh } << "__EOFOO__", $stuff, $morestuff);

The problem is that perl has to decide whether << starts a heredoc or means a left shift operator, and it guesses wrong in the case you show in your post.

Update: parenthesis around the here-doc would also work:

printf($fh (<< "__EOFOO__"), $stuff, $morestuff);