#!/usr/bin/perl my $tf = shift; # any random text file. Say, /etc/passwd open(MF, "< $tf") || die "Unable open $tf for input: $!"; # this doesn't work # my %opt; $opt{'M'} = *MF; while (<$opt{'M'}>) { print "loop one...\n"; } # this doesn't work # my @opt; $opt[0] = *MF; while (<$opt[0]>) { print "loop two...\n"; } # this does work # my $tf = *MF; while (<$tf>) { print "loop three...\n"; }