Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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


In reply to Re: Re: Comma Delimited File by broquaint
in thread Comma Delimited File by curtisb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2024-04-25 02:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found