Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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 chilling in the Monastery: (9)
As of 2014-09-21 20:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (175 votes), past polls