my @files= qw| /path/to/file1 /path/to/file2 /path/to/file3 |; my @allfiles; for my $filename(@files){ open(FILE," $filename") || die "Cannot open $filename: $!\n"; while() { push @allfiles, $_; } close(FILE); }