I've been using Perl a great deal recently for reasonably large projects (eg perl simplifies catalog production) spanning weeks or months... OO, modules, POD, all the heavy equipment of Perl. Been in the mindset of big perl programs.

Today I received a data file from another firm... a text file in a pretty ugly format: one line per order, followed by a line for each item on the order (so a variable number of lines per order), using a strange datetime format ("Wed 20 Aug 08:05:16 2000"), embedded commas and dollar signs in the money fields... delimited by spaces -- and of course the description field also contained internal spaces... simply yuck.

A few lines of perl and ... whoooomph! ... the data are clean, normalized, and happily sitting in a database.

Clearly preaching to the choir here, but damn, Perl sure makes parsing tasks easy...

Replies are listed 'Best First'.
(Ovid) RE: good ol' text parsing...
by Ovid (Cardinal) on Nov 04, 2000 at 00:07 UTC
    Boy, can I ever appreciate what you're saying! In this node, I mentioned that I reduced 150 lines of COBOL that was reading data from a CSV file to 10 lines of Perl -- and that was with error checking.

    Perl is not the end-all and be-all, but I've never worked in another language that allows me to massage text data as quickly and easily as Perl.

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just go the the link and check out our stats.

RE: good ol' text parsing...
by neophyte (Curate) on Nov 04, 2000 at 16:19 UTC
    This is what I most often use perl for: receiving data from whatever source hack it with my swiss army chain saw, so it doesn't trouble me any more.
    I even carved a html2php parser, which takes a piece of html and generates echo commands with all the right quotes. So when I use php with heavily mixed code and html, I tell the designer to give me his code, and in a matter of seconds I have my php-statements. Might seem a bit strange, but I like Perl.

    neophyte

RE: good ol' text parsing...
by Albannach (Monsignor) on Nov 03, 2000 at 23:22 UTC
    AMEN brother! Tell it like it is! (I feel a gospel tune comming on)

    I still have flashbacks to the DAYS of C or Fortran I used to write, which are now replaced by minutes of Perl (big silly grin), and the Perl is far easier to maintain!

RE: good ol' text parsing...
by AgentM (Curate) on Nov 04, 2000 at 01:07 UTC
    "Just say NO to Excel-generated textfiles!" Ouchie! The only thing I'm missing here is why Perl programmers accomplish the same task FOR LESS CASH FOR LESS TIME ON THE SAME PROJECT. The Pascal programmer just got 6*x bucks richer when you did the same thing in ten minutes. It's time for an uprising! (All you meanie-pointy-haired bosses out there- this is the REASON to hire Perl programmers.)
    AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.