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.
Consider using @ARGV instead of hardwiring the input file names inside the script. And also consider using STDOUT instead of hardwiring the output file name inside the script.
I like File::Glob::bsd_glob().
#!perl use strict; use warnings; use English qw( -no_match_vars ); use File::Glob qw( bsd_glob ); @ARGV or die "Usage: perl $PROGRAM_NAME <CSV file> ...\n"; @ARGV = map { bsd_glob($ARG) } @ARGV; while (my $row = <ARGV>) { # Presumably, something useful happens to $row here; # otherwise this script is just cat(1) in Perl print $row; } exit 0;
Jim
In reply to Re: How do I merge every csv file in the directory?
by Jim
in thread How do I merge every csv file in the directory?
by luxlunae
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |