foreach my $file ( @files ) { open FH, '<', $file or do { warn "Cannot open '$file' $!"; next; }; my @fileContents = ; close FH; //Do something with @fileContents }