sigzero has asked for the wisdom of the Perl Monks concerning the following question:
Perl Monks,
I currently have this simplistic script:
open( INFILE, "<$filename" ) || die "$!\n"; open( OUTFILE, ">>dataload.errs" ) || die "$!\n"; while ( $line = <INFILE> ) { if ( "***M" eq substr $line => 0, 4 ) { print OUTFILE $line; } if ( "!!!" eq substr $line => 0, 3 ) { print OUTFILE $line; } if ( "@@@" eq substr $line => 0, 3 ) { print OUTFILE $line; } } close( INFILE ); close( OUTFILE );
This goes through and strips out the lines that start with certain characters. I am happy with that (although any pointers are gladly appreciated).
Now I want to put the total of lines that were written for each group at the end of the file like:
Total errors for @@@: 3 Total errors for ***: 5 Total errors for !!!: 9
Your wisdom and help will be appreciated!
Robert
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Counting lines as I write them...
by Zaxo (Archbishop) on Apr 11, 2005 at 14:30 UTC | |
|
Re: Counting lines as I write them...
by Fletch (Bishop) on Apr 11, 2005 at 14:25 UTC | |
by Tanktalus (Canon) on Apr 11, 2005 at 15:16 UTC | |
by Fletch (Bishop) on Apr 11, 2005 at 15:43 UTC | |
|
Re: Counting lines as I write them...
by fglock (Vicar) on Apr 11, 2005 at 14:32 UTC | |
|
Re: Counting lines as I write them...
by sh1tn (Priest) on Apr 11, 2005 at 14:23 UTC | |
by Fletch (Bishop) on Apr 11, 2005 at 14:33 UTC | |
|
Re: Counting lines as I write them...
by davidrw (Prior) on Apr 11, 2005 at 16:22 UTC |