A stylistic advice reference is Perl Best Practices,
Chapter 10 (I/O), Item 136: Always put filehandles in braces within any print statement:
It's easy to lose a lexical filehandle that's being used in the argument list of a print:
print $file $name, $rank, $serial_num, "\n";
Putting braces around the filehandle helps it stand out clearly:
print {$file} $name, $rank, $serial_num, "\n";
The braces also convey your intentions regarding that variable; namely that you really
did mean it to be treated as a filehandle, and just didn't forget a comma.
An alternative syntax using IO::Handle:
use IO::Handle;
$file->print( $name, $rank, $serial_num, "\n" );