in reply to Comma Delimited File
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re(2): Comma Delimited File
by dmmiller2k (Chaplain) on Nov 08, 2001 at 04:02 UTC | |
This problem breaks neatly into two smaller ones. First, there is the problem of reading the CSV file. That problem may be (temporarily) simplified by assumimg the data has no embedded commas (or perhaps the file could be made to use tab or '~' or some other separator not part of the data). Then the problem simplifies to a sorting one (as I read the problem statement). I.e., sort a two-dimensional array of data by the first three columns (however many other columns there are). The simplest way to do this might then be this:
Let me acknowledge that the problem of extracting CSV data is more complex than simply splitting on ','. However, it may be made a simpler problem by specifying a different separator character--tab is my favorite, '|' (pipe) or '~' (tilde) work pertty well, too. Excel, for one thing, can write a tab-delimited file (having read the data from a comma-separated one). This neatly end-runs the whole Text::CSV_XS issue, if possible, which IMHO is a good thing. dmm | [reply] [d/l] |