in reply to Dynamic File Handles
Indirect Filehandles
"open"'s first argument can be a reference to a
filehandle. As of perl 5.6.0, if the argument is
uninitialized, Perl will automatically create a
filehandle and put a reference to it in the first
argument, like so:
open( my $in, $infile )
or die "Couldn't read $infile: $!";
while ( <$in> ) {
# do something with $_
}
close $in;
It doesn't get much more dynamic than that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dynamic File Handles
by Anonymous Monk on Jun 06, 2005 at 21:02 UTC | |
by cmeyer (Pilgrim) on Jun 06, 2005 at 21:07 UTC |