CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [BigRedEO] Parsing CSV file - Add Concatenated field/sort: Edit Log



FishMonger
Veteran / Moderator

Mar 28, 2016, 8:40 AM


Views: 34332
Re: [BigRedEO] Parsing CSV file - Add Concatenated field/sort

I'm unable to duplicate that problem using the sample data you provided. Maybe the test.csv file you tested is different from what you posted.

Have you tried the other version using DBI and DBD::CSV?

Here's the adjustment it needs to add the concatenated fields.

Code
my $sth = $dbh->prepare("SELECT * 
FROM test
ORDER by STORE_NBR,
CONTROL_NBR,
LINE_NBR,
INIT_TRAN_DATE,
UPDATE_TRAN_DATE,
UPDATE_TRAN_TIME");
$sth->execute;

while (my $row = $sth->fetch) {
my @row = @$row;
unshift @row, join '_', @row[0..2];
print Dumper \@row;
#print join(',', @row), $/;
}



(This post was edited by FishMonger on Mar 28, 2016, 8:48 AM)


Edit Log:
Post edited by FishMonger (Veteran) on Mar 28, 2016, 8:41 AM
Post edited by FishMonger (Veteran) on Mar 28, 2016, 8:47 AM
Post edited by FishMonger (Veteran) on Mar 28, 2016, 8:48 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives