Perl has got a command line option '-n' that supports multiple file processing at the same time. Here $_ will have each line. This option is much faster than using a FileHandle for the cases where the number of files are not known. Look for -n option on command line.