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

Re^3: Doublequotes in column

by Marshall (Canon)
on Dec 06, 2011 at 09:45 UTC ( [id://941979]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Doublequotes in column
in thread Doublequotes in column

Well, tr will remove the " characters, like below...
tr is a simple minded critter, but it is faster than substitute.

If you created this with Text::CSV, then I would use that to parse it back in. Normally, I don't think that you have to specify the XS version, if its there, then it gets used - to the best of my knowledge.

I'm still on a marathon DB project, but my machine has to think for 4-5 hours about what I've done so far. But on this project, | is used as the CSV delimiter instead of "," and that often works out very well. Sometimes I also see || and that is ok too (in the split, you can specify /\|\|/ as the splitting regex. In the DB that I'm working with | is explicitly not allowed as a valid data field value and hence it can be used as a simple delimiter in the CSV format and the Text::CSV module is not needed. But mileage varies...

#!/usr/bin/perl -w use strict; while (<DATA>) { tr/"//d; print; } # prints: # some,always,quoted stuff # more,stuff,like that __DATA__ "some","always","quoted stuff" "more","stuff","like that"

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-26 01:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found