if (m/<(.*?)>/) { my $email = $1; if ($email =~ /@.*\./) { # ok, do something with it. } }