http://www.perlmonks.org?node_id=125064


in reply to Email Header

Try this to grab the email addresss from $from as $email:

my ($email) = $from =~ /<([^>]+)>/ if $1;

Might be an idea to have a look at the Mail::Header module.

By the way, and this isn't relevant to your question, but you don't need to quote $1 (eg, $from = "$1"... in your example above.)