in reply to store multiple files in multidimensional array

if I do it thru a reference the content will change in the next loop when I modify @currentFile again

Don't define @currentfile in that scope then.

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