#!/usr/bin/perl -w use strict; die "usage: $0 filename" if @ARGV != 1; my $header = 0; my ($from, $to); while (<>) { /^\s*$/ && last; /^From/ or /^[a-zA-Z-]+:/ or die "$ARGV:$.:bad line in header: $_"; if (/^From:\s*(.+)) { /^--\s*$/ && last; /^--------+\s*$/ && last; ++$blank, next if /^\s*$/; ++$quoted, next if /^\s*>/ or (/$to/ and /wrote:\s*$/); ++$sig, next if /^\s*$from\s*$/; ++$content; } print "body:\tblank:\t\t$blank\n"; print "\tquoted:\t\t$quoted\n"; print "\tcontent:\t$content\n"; while (<>) { ++$sig, next; } print "signature:\t$sig\n";