in reply to Re: CSV problem
in thread CSV problem

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: CSV problem
by barakuda (Initiate) on Mar 07, 2008 at 17:47 UTC

    I dunno. It doesn't work for some reason:

    open (OUT, ">Curr_Closed.csv"); open (RAW, "<Prelim_CC.csv") or die "ERROR: Could not open Curr_Cl +osed.csv"; while (<RAW>){ chomp ($_); my @columns = split (/,/, $_, 10); $columns[9] =~ s/,/;/; print OUT $columns[9]."\n"} close (RAW); close (OUT);

    What this does is takes only the first comma in 10th column and changes it to semilon. But fields that have more than one comma are still messed up.

    Am I using regexp wrong?

      Yes, you need g on the end

      $columns9 =~ s/,/;/g;

      Untested.

      J.C.