for my $file (@pal_files) { open my $IN, '<', $file or die "$file: $!\n"; while (my $line = <$IN>) { # Process the line... } }