Well, off the top of my head, I'd say you could make all of your date calculations a whole lot simpler with Date::Calc.

Update: Here's the script, sans hand-rolled date processing:

#! /usr/bin/perl use strict ; use warnings ; $|++ ; use Date::Calc qw( Add_Delta_Days Day_of_Week Today ) ; my $days_back = shift || 120; my @start_ymd = Add_Delta_Days( Today, -$days_back ) ; my @end_ymd = Today ; my $start = sprintf( "%d-%02d-%02d", @start_ymd ) ; my $end = sprintf( "%d-%02d-%02d", @end_ymd ) ; print"$start\n$end\n\n"; system("parsecache -f nlclick -s $start -e $end > nlclick.cache"); system("parsecache -f nlimage -s $start -e $end > nlopen.cache"); for my $i ( 0 .. $days_back - 1 ) { my $wday = Day_of_Week ( @start_ymd ) ; if ( $wday > 0 && $wday < 6 ) { my $date = sprintf("%d%02d%02d", @start_ymd ); #print "$date\n"; $opens = `report pattern --regex='nl=$date' --filter=nlimage - +-sumonly < nlopen.cache`; if ( defined( $opens ) ) { $transfers = `report pattern --regex='nl=$date' --filter=s +tandard --sumonly +< nlclick.cache`; if ( !defined( $transfers ) ) { $transfers = 0 } printf("update msnNewsletter set open='%d', click='%d' whe +re dateCreated like '%d-%02d-%02d%%';\n", $opens, $transfers, @start_ +ymd ); } } } unlink "nlclick.cache"; unlink "nlopen.cache"; __END__

You're original handling of the system calls is rather odd, assigning to $_ and then capturing it all to a variable. The only thing that comes to mind is taint checking, which you're not doing here, so that section can also be simplified some.

Note that none of these necessarily have anything to do with the speed of your program, but may impact it's accuracy, and certainly improve it's maintainability.


_______________
DamnDirtyApe
Those who know that they are profound strive for clarity. Those who
would like to seem profound to the crowd strive for obscurity.
            --Friedrich Nietzsche

In reply to Re: Parsing a lot of data. Very slow. Need suggestions by DamnDirtyApe
in thread Parsing a lot of data. Very slow. Need suggestions by vxp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.