...but it only gives me the last file's content.
foreach my $file (@files) { ... open FILE, ">$dir/$file"; ... }
Open the output file once outside of the loop, or open it in append mode (">>"), if you want to accumulate content...
Update: Actually, it seems that FILE2 is supposed to be the output file for the accumulated content... (thanks jethro!) The comment with respect to opening it once or in append mode still applies, though.
In reply to Re: concatenate directories and files into one csv
by almut
in thread concatenate directories and files into one csv
by grashoper
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |