Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: i need to join two fields in .csv file??

by Tux (Monsignor)
on Mar 14, 2013 at 08:45 UTC ( #1023420=note: print w/ replies, xml ) Need Help??


in reply to Re: i need to join two fields in .csv file??
in thread i need to join two fields in .csv file??

PLEASE advice using getline () instead of perl's internal getline:

open my $fh_in, "<", "test.csv" or die "test.csv: $!"; open my $fh_out, ">", "test_new.csv" or die "test_new.csv: $!"; my $csv_in = Text::CSV->new ({ binary => 1, auto_diag => 1 }); my $csv_out = Text::CSV->new ({ binary => 1, auto_diag => 1, eol => "\ +n" }); while (my $row = $csv_in->getline ($fh_in)) { $csv_out->print ($fh_out, [ @{$row}[2,1,0,3] ]); }

Enjoy, Have FUN! H.Merijn


Comment on Re^2: i need to join two fields in .csv file??
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1023420]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2015-07-05 19:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls