Re: Parsing a text file with mutuple seperator
[email protected] (Johan Vromans) 09 Apr 2008 00:02:43 +0200
| Newsgroups | perl.scripts |
|---|---|
| Message-ID | <[email protected]> |
[email protected] writes: > I am writing a perl script to parse a file. The data in the file is > seperated by space/tab. However, certain fields may be empty or > consist of mutiple words and are double quoted and this makes it > difficut for me to do a split. > > Example of data: > "" "This is 2nd field" > 3 4 > 1 2 > "" 4 > 1 2 "The field may consist of (meta) > characters" "" I think Text::CSV (Text::CSV_XS) can handle this. Just set the separator to Tab. -- Johan