jroberts has asked for the wisdom of the Perl Monks concerning the following question:
#!/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"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: hashs and file handle globs
by broquaint (Abbot) on Nov 20, 2002 at 14:56 UTC | |
by jroberts (Acolyte) on Nov 20, 2002 at 15:56 UTC | |
by broquaint (Abbot) on Nov 20, 2002 at 16:24 UTC | |
|
Re: (nrd) hashs and file handle globs
by newrisedesigns (Curate) on Nov 20, 2002 at 14:51 UTC | |
|
Re: hashs and file handle globs
by MarkM (Curate) on Feb 02, 2003 at 08:35 UTC |