in reply to Strange Behavior while Parsing Sendmail logs

Try.
($to_addr)=$_=~/......
instead of what you have. I don't have time to go into the details of why right now. I will ammend this note later with full details.