in reply to Counting lines as I write them...

You can keep seperate counts in a hash,

my %count; @count(qw/@@@ *** !!!/) = (0) x 3;
Wherever you find a match, increment the corresponding key,
if ( "!!!" eq substr $line => 0, 3 ) { $count{'!!!'}++; print OUTFILE $line; }
and so on. To print out the results,
printf "Total errors for %s: %d\n", $_, $count{$_} for keys %count;

After Compline,
Zaxo