use strict; open(FILENAMES, ") { chomp $fileInfoString; my @fileInfo = split(/\t/, $fileInfoString); my $filePath = sprintf "%s\\%d\\%02.d\\", $fileInfo[0], $year, $month; unless(open SOURCE_FILE, "<$filePath$fileInfo[1]") { print STDERR "$filePath$fileInfo[1] not opened: $!\n"; next; } print STDERR "$filePath$fileInfo[1] opened.\n"; my $count; while (my $line = ) { $count++; } print "$count lines.\n"; close SOURCE_FILE; }