Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
go ahead... be a heretic
 
PerlMonks  

Re: Best Way To Parse Concordance DAT File Using Modern Perl?

by space_monk (Chaplain)
on Dec 09, 2012 at 06:48 UTC ( #1007956=note: print w/ replies, xml ) Need Help??


in reply to Best Way To Parse Concordance DAT File Using Modern Perl?

Furher to what 2teez said, simply use Text::CSV or one of its close relatives to parse the file. You can change the field/end of line separators simply by specifying them when you instantiate the object. e.g. in the case of Text::CSV:

$csv = Text::CSV->new ({ quote_char => '"', escape_char => '"', sep_char => ',', eol => $\, always_quote => 0, quote_space => 1, quote_null => 1, binary => 0, keep_meta_info => 0, allow_loose_quotes => 0, allow_loose_escapes => 0, allow_whitespace => 0, blank_is_undef => 0, empty_is_undef => 0, verbatim => 0, auto_diag => 0, });
It also has support for encoding format etc.
A Monk aims to give answers to those who have none, and to learn from those who know more.


Comment on Re: Best Way To Parse Concordance DAT File Using Modern Perl?
Download Code
Re^2: Best Way To Parse Concordance DAT File Using Modern Perl?
by Jim (Curate) on Dec 09, 2012 at 18:19 UTC

    Unfortunately, Text::CSV_XS doesn't work. It can't parse Concordance DAT files like the one I described.

    Is there another way?

    Jim

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2014-04-17 22:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (458 votes), past polls