in reply to Extracting email addresses
Check out the Email::Address module. The parse() method will parse a line and return a list of address objects. Then just use the user() and host() methods on the returned addresses to create your output string.