in reply to Naming file handles with variables?

use IO::File;
@handles = grep defined, map {
   new IO::File ($_, 'r')
   || warn ($_, ': cannot open: ', $!)
      && undef
} @file_names;

while (@list = grep defined, map scalar <$_>, @handles) {
  for $line (@list) {
    # do stuff with line
  }
}
  • Comment on Re: Naming file handles with variables?