foreach $filename (@all_file_names) { open CURFILE $filename; while () { chomp; #do stuff with each line here... } close(CURFILE); }