in reply to Opening files in a loop
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 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Opening files in a loop
by loop362 (Pilgrim) on Jun 04, 2005 at 02:24 UTC |