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. In reply to Re: Dynamic File Handles
by trammell
in thread Dynamic File Handles
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |