Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^5: Converting File Delimiters

by Tux (Abbot)
on May 22, 2013 at 06:42 UTC ( #1034682=note: print w/replies, xml ) Need Help??


in reply to Re^4: Converting File Delimiters
in thread Converting File Delimiters

my $ic = Text::CSV->new ({ binary => 1, allow_whitespace => 1, auto_di +ag => 1 });
allow_whitespace When this option is set to true, whitespace (TAB's and SPACE's) surrounding the separation character is removed when parsing. If either TAB or SPACE is one of the three major characters "sep_char", "quote_char", or "escape_char" it will not be considered whitespace. Now lines like: 1 , "foo" , bar , 3 , zapp are correctly parsed, even though it violates the CSV specs. Note that all whitespace is stripped from start and end of each field. That would make it more a feature than a way to enable parsing bad CSV lines, as 1, 2.0, 3, ape , monkey will now be parsed as ("1", "2.0", "3", "ape", "monkey") even if the original line was perfectly sane CSV.

Enjoy, Have FUN! H.Merijn
2.0

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1034682]
help
Chatterbox?
[Eily]: LanX how dare you imply that I made a typo? It's true but still!
[Eily]: or is it a typo if the mistake was in my brain rather than in the process of typing?
[LanX]: they were talking about meatspace recently ...
[choroba]: a "thinko"
[erix]: my app (google, really) makes that 1530 km...
[Eily]: google tells me 1662 km ...
[LanX]: Nancy? Somewhere near Metz ...
[Eily]: must be km farenheit or something :P
[Eily]: wow, don't say that in Nancy LanX :P
[erix]: maybe you used the car routes, I used the walking routes

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (11)
As of 2017-12-13 15:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (369 votes). Check out past polls.

    Notices?