in reply to hashs and file handle globs

The text within <> must be a 'simple scalar variable' in order for it to be interpretted as a reference to a typeglob, and not a shellglob. See the perlop manpage for more information.

To accomplish what you are trying to do, I recommend using the readline() builtin function that provides the same functionality as <> does:

my %opt; $opt{'M'} = \*MF; # You should use a reference here. while (readline($opt{'M'})) { print "loop one...\n"; }

Using readline() allows you to specify an arbitrarily complex expression, while still getting the same behaviour that <> does. For example, readline() also has the behaviour of wrapping an implicit defined($_ = readline(...)) around the readline().