in reply to Dynamic File Handles

From perldoc perlopentut:
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
    Thats awesome. See If I just read the manual I would have been fine :-) Have a great day!
      Heh. For some reason I always assume that folks have read the fine manual before posting here. :)