Actually, filehandles (and dirhandles) are not just scalars. In fact, if you look at the value returned by new FileHandle, you will see that it is a reference to a GLOB.
Because filehandles (and dirhandles) don't have a special syntax, like scalars/arrays/hashes, you have to refer to the entire glob instead. This is why you see code like:
sub myprint {
my($fh) = @_;
print $fh "Hello world.\n";
}
myprint \*STDOUT;
The
FileHandle and
IO::Handle modules make it more convenient to use arbitrary handles, because they hide the reference-to-glob syntax.