On Feb 9, 8:08 am, clay.lov...@carquest.com (Clay Lovett) wrote:
> I have inherited a script that processes the cron and comments stuff out for 
> month end processing. We have added some store that do not run the same 
> monthly calendar as the rest of the stores. What I need to know is how to add 
> a start and a finish section to the code so that it only processes the 
> section I want it to.

... snip ...

while (<CRONDMP>) {
    if ( /pattern1/ ... /pattern2/ ) {
        # do something here, like
        print "    matched: $_";
    }
    else {
        # do something different
        print;
    }
}

You can also match on line number:

    if ( $. == 100 ... $. == 150 ) { ... }

or a combination:

    if ( $. == 200 ... /^your reg[ex]/ ) { ... }

HTH.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to