They all work very similar: they live in a package. Your filehandle with the name `NamFile' lives in package main. As long as you are playing with only one package, you don't need to worry about qualifying your filehandles. But from one package to another you have to.

In your example you passed the NAME of a filehandle to a subroutine without qualifying it. The -w switch would have helped you to recognize this:

~> perl -lwe 'package FOO; sub testFH {

print $fh "$text";

Quote:

}

package main; open FH, ">testfile"; print FH "from main"; FOO::testFH(FH,"going through a package"); ' Identifier "main::FH" used only once: possible typo at -e line 7. Filehandle FH never opened at -e line 4. ~>

Hmm. I'd like to know exactly what objects are what and how to determine that in the program. Are these really objects in the OO sense? Or did you mean types. I know this sounds like nitpicking, but I'll give you an idea of what I mean: