I try to take the KISS approach. If you don't need the SQL functionality, why not just open 2 output files - the individual .csv file and a "Master" .csv file - and print your data to both files.
# Setup the Master list
open(MASTERFILE, ">>$dir/MasterList.csv")
or die "Can't open MasterList.csv: $!";
# Set up a loop to "Do Stuff" tm
my @src_files = <$src_dir/*.csv>;
foreach my $src_file (@src_files) {
open (INFILE, "$src_file")
or die "Can't open $src_file for input: $!\n";
while (<INFILE>) {
chomp;
#
# Do Stuff Here!
#
open (OUTFILE, ">>$dest_file")
or die "Can't open $dest_file for output: $!\n";
print OUTFILE "Your records go here\n";
print MASTERFILE "Your records go here\n";
close OUTFILE;
}
close MASTERFILE;
If you don't need the individual .csv files just leave out the appropriate open and print statements.
HTH,
Jack
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.