luxlunae has asked for the wisdom of the Perl Monks concerning the following question:
As you can see my weakness is actually getting all of the csv file names into an array. I think this is going to be solved with a map command but I wasn't able to figure it out myself.open(MYOUTFILE, ">output.txt"); #open for write, overwrite my $filecount = 0; my @filenames; ###code that assigns all the csv file names in the present folder #to an array and counts them foreach $inputfilename (@filenames) { open INPUT, "<$inputfilename"; @lines = <INPUT>; close INPUT; foreach $row (@lines) { print MYOUTFILE ("$row\n"); } close INPUT; } close MYOUTFILE; my $ovr = <STDIN>; exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I merge every csv file in the directory?
by choroba (Cardinal) on Jun 27, 2012 at 17:36 UTC | |
by SuicideJunkie (Vicar) on Jun 27, 2012 at 18:10 UTC | |
by luxlunae (Novice) on Jun 28, 2012 at 13:12 UTC | |
|
Re: How do I merge every csv file in the directory?
by Jim (Curate) on Jun 27, 2012 at 18:51 UTC | |
|
Re: How do I merge every csv file in the directory?
by Anonymous Monk on Jun 27, 2012 at 17:36 UTC |