my @array = (); for $file ( qw(file1 file2 file3) ){ open(IN,'<',$file) while(IN){ chomp; split; } close (IN) }