open FH, "mylog" etc.... while () { do these steps } #### $to_addr = ($_ =~ rest of stuff);