use strict; my $filename = shift; open( INFILE, "<$filename" ) || die "$!\n"; open( OUTFILE, ">>dataload.errs" ) || die "$!\n"; my %count; my $line; while ( $line = <INFILE> ) { if ( $line =~ /^( \*{3}M | \!{3} | \@{3} )/x ) { $count{$1}++; print OUTFILE $line; } } close( INFILE ); close( OUTFILE ); print "Total errors for $_: $count{$_}\n" for keys %count;
In reply to Re: Counting lines as I write them...
by fglock
in thread Counting lines as I write them...
by sigzero
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |