sub checkReadTime # call this with just your list of files { my $linecount = 0; my $starttime = time; for my $file ( @_ ) { my $fh = &openLogFile($file) or next; while ( <$fh> ) { $linecount++; } close $fh; } my $endtime = time; warn sprintf( "read %d lines from %d files in %d sec\n", $linecount, scalar @_, $endtime - $starttime ); } #### filterLogFiles file.list | sort | your_main_app #### open( my $logsort, "-|", "filterLogFiles @files | sort" ) or die $!; while ( <$logsort> ) { ... }