# main while(read(FIN,$data,$bsize)) { while (length($data)) { if ($data =~ /^([\d\w]+)/ ) { notate('A', length($1)); } # more if's } } # sub notate { my $c = shift; my $n = shift; if ((! defined $c) || (! defined $n)) { close(FIN); if ($opt_M) { close(FOUT); } print STDERR "$0 : FATAL ERROR in sub notate\n"; exit; } $count{$c} += $n; substr($data,0,$n) = ''; # dangerous if (! $opt_M) { $mstr .= $c; } else { print FOUT "$c"; } return(0); }