in reply to how do I line-wrap while copying to stdout?

Since no one's checked in on this part...
You can replace the 10 lines dealing with $rcvdflag with:
$rcvd &&= /^\s/ and next; $rcvd = /^Received:/ and next;
Basically, set it on "Received:" and keep it set til it doesn't match /^\s/.

p