my @combinedData; my @filesList = <*>; foreach my $file (@filesList) { my @currentFile; open(F, "file.txt") or die("Unable to open file"); @currentFile = ; # HOW TO COMBINE IT INTO @combinedData ? push @combinedData, \@currentFile; }