http://qs321.pair.com?node_id=126711


in reply to How can I extract the username and hostname/domain from e-mail addresses?

The Mail::Address and Mail::Header modules can do this task:

use Mail::Header; use Mail::Address; my $header = Mail::Header->new([@lines]); my($from) = Mail::Address->parse($header->get("From")); my($user,$host) = ($from->user(),$from->host());

Edit by tye