Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Data validation and blank spaces in tab formatted csv file

by keszler (Priest)
on Oct 24, 2013 at 13:44 UTC ( [id://1059460]=note: print w/replies, xml ) Need Help??


in reply to Data validation and blank spaces in tab formatted csv file

I'm a bit confused - you use Text::CSV_XS;, but don't use it. I would think that the blank_is_undef and empty_is_undef options of Text::CSV would be useful to you.

Replies are listed 'Best First'.
Re^2: Data validation and blank spaces in tab formatted csv file
by Ma (Novice) on Oct 24, 2013 at 14:09 UTC
    Thanks, I have not used Text:CSV_XS. Can the existing code be changed to accommodate the requirements for null and blank spaces.

      For output, that would be similar to input

      my $csv_o = Text::CSV_XS->new ({ binary => 1, sep_char => "\t", auto_d +iag => 1, eol => $/ }); open my $fhv, ">", $file_to_parse_valid or error ("Cannot open file +for write: $!"); open my $fhi, ">", $file_to_parse_invalid or error ("Cannot open file +for write: $!"); while (…) { if ("valid") { $csv_o->print ($fhv, [ $chu, $dev, $development_name, $bldg_no, $bldg_name, $unit +_id, $proj, $proj_name, $bdsz, $st_no, $street_name, $apt_no, $p_code, + $un_st, $mkt, $max_rent, $fut_movein, $p, $last_move_in, $last_move_out, + $pgm, $clt_no, $mgr_cd, $manager, $unit_status_dt, $cont_occ_dt, $pending +_move_out_dt, $unit_status_desc ]); } else { $csv_o->print ($fhi, [ $chu, $dev, $development_name, $bldg_no, $bldg_name, $unit +_id, $proj, $proj_name, $bdsz, $st_no, $street_name, $apt_no, $p_code, + $un_st, $mkt, $max_rent, $fut_movein, $p, $last_move_in, $last_move_out, + $pgm, $clt_no, $mgr_cd, $manager, $unit_status_dt, $cont_occ_dt, $pending +_move_out_dt, $unit_status_desc ]); }

      Enjoy, Have FUN! H.Merijn

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-24 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found