@files =qw (file1 file2 file3 file4); foreach(@files) { open ($fh, "$_"); while(<$fh>) { ... } close($fh); }