in reply to DBD::CSV and really bad legacy flat file

I'm probably missing something but any-way why won't something along the lines of this work?

my @line = split /_ /, $line;

Posting some sample data would help!

--
Murray Barton
Do not seek to follow in the footsteps of the wise. Seek what they sought. -Basho

Replies are listed 'Best First'.
Re^2: DBD::CSV and really bad legacy flat file
by Ovid (Cardinal) on Jul 19, 2005 at 07:05 UTC

    That fails because parsing CSV-style data is more difficult than it appears. The first hurdle is how to handle when the separator appears in a quoted field ("joe _blow" _ 2 _ "hourly"). The second hurdle is more fiendish: newlines embedded in quoted fields. It's less likely to occur, but if it does, iterating over records becomes painful.

    Cheers,
    Ovid

    New address of my CGI Course.

      I hadn't considered newlines but the separator sounded like it would be unique enough in this instance, the original poster described it as "space underscore space with _UNSC being the escape string"... which I admit isn't entirely clear to me and why I suggested the OP post some sample data, I just took the liberty of simplifying it to "_ " for my example, my bad! :-)

      --
      Murray Barton
      Do not seek to follow in the footsteps of the wise. Seek what they sought. -Basho