while() { my $body = /^$/ .. eof; #First blank line in email is start of body my $header = 1 .. /^$/; print "looking at line ",int$body," in the body\n" if $body; print "looking at line ",int$header," in the header\n" if $header; }