http://www.perlmonks.org?node_id=1007956


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.

Replies are listed 'Best First'.
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