The line of code I quoted overwrites the contents of @data each time through the loop. You can open as many files as you like, but the code only ever stores the lines from the last file you read.
A quick fix might be to replace that with push @data, <FH>;.
As a side note, you can loop over the contents of an array without an index with:
for my $name (@data_names) { # open files here }
In reply to Re: Opening files in a loop
by chromatic
in thread Opening files in a loop
by loop362
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |