Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Comma Delimited File

by mikeB (Friar)
on Nov 07, 2001 at 21:19 UTC ( #123856=note: print w/replies, xml ) Need Help??


in reply to Re: Comma Delimited File
in thread Comma Delimited File

Could you fill us in on the problems you've had with Text::CSV_XS? I've had no trouble so far using it with files generated by Excel.

Replies are listed 'Best First'.
Re: Re: Comma Delimited File
by broquaint (Abbot) on Nov 07, 2001 at 23:16 UTC
    As I said, the problem was probably me and not Text::CSV_XS. But so as not to be elusive I'll fill you in as to why I gave up on it.

    Firstly I was working on something that had to done as fast as humanly (or inhumanly as the case sometimes is) possible, so when I encountered the problems with Text::CSV_XS I didn't spend too much time on figuring out what wrong.
    I wasn't doing anything particularly fancy or neat, just formatting some data from a TDF. But for some reason it would only find 4 of 9 records, and I can't see why. There wasn't anything too gruesome in the data (as it was created to be as friendly as possible) and splitting it on "\t" seemed to work a treat so I stuck with that.

    If you're interested in the code it was something like this -

    use strict; use Text::CSV_XS; my $tdf = Text::CSV_XS->new({'sep_char'=>"\t"}); open(TDF, "somedata.tdf") or die("b0rk - $!"); my @fields = (); while($tdf->parse(scalar <TDF>)) { @fields = $tdf->fields(); print "@fields\n"; }
    That seems to work fine on some simple data, but it broke on the data I was feeding it, so I'm guessing that the data was the root of the problem (and I would've dug further but I was under a *wee* bit of pressure ;o). I should imagine I'll use it if the need ever arises again, and hopefully the data behaves itself this time (assuming it was the data ...)
    HTH

    broquaint

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2022-01-25 13:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (66 votes). Check out past polls.

    Notices?