Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^2: print line not showing up

by Anonymous Monk
on Oct 30, 2007 at 14:46 UTC ( #648021=note: print w/replies, xml ) Need Help??

in reply to Re: print line not showing up
in thread print line not showing up

I currently use this:

open(INFILE,"<$cvsDir/$file") || die("can't open datafile $file: $!"); $csv = Text::CSV_XS->new(); while(<INFILE>) { $status = $csv->parse($_); if ($status == 0) { $bad_argument = $csv->error_input(); print "\t\tBad Argument: $bad_argument\n"; exit; } ... stuff it in my hash ...

1.) I use Text::CSV_XS, but without the { binary => 1 }, does that make a big difference? What is the { binary => 1 } expected to help to my problem? *)

2.) I thought my CSV parsing was okay, because the expected content shows up in my debug print lines? I even thought the hash *insertion* was okay, for the same reason?

*) I tried that at the moment, it doesn't change anything.

Replies are listed 'Best First'.
Re^3: print line not showing up
by thezip (Vicar) on Oct 30, 2007 at 16:41 UTC

    Per the Text::CSV_XS docs, by turning on "binary", it allows the parser to accept a wider range of characters. "To cover the widest range of parsing options, you will always want to set binary."

    I just was not making any assumptions about the data that you are trying to parse.

    Given that, I'd say your next step would be to isolate which specific lines are failing. You can do this by writing the good lines into one file, and if possible, the bad lines into another file. If you can't write the bad lines into another file, then you'll have to determine which lines are missing from the good file.

    To aid in this process, you might prepend a unique index (source line # ?) to the beginning of each line.

    Where do you want *them* to go today?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://648021]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2018-06-19 10:00 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (113 votes). Check out past polls.