in reply to Seeking best approach to column parsing

Since your data appears to be fixed-width, you could use unpack instead of split, which should be much faster.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

: () { :|:& };:

Note: All code is untested, unless otherwise stated

Replies are listed 'Best First'.
Re: Re: Seeking best approach
by davido (Cardinal) on Nov 25, 2003 at 18:27 UTC
    That's a fact! unpack may be intimidating at first, but if you're looking at fixed-width columns (as your examples seem to indicate), unpack is going to be faster than split. Consider split when you don't have fixed-width data, and unpack when you do.

    Another advantage to unpack for fixed-width column data is that if one of the fields should be filled completely (leaving no whitespace at all), splitting on whitespace will fail, while unpack will still work fine.


    Dave


    "If I had my life to live over again, I'd be a plumber." -- Albert Einstein