mhearse has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to figure out the grep syntax to extract the domain from an email address. It seems simple but I'm stuck! Thanks for your help.

my @domains = grep { /.+@(.+)/ } @emails;

Replies are listed 'Best First'.
Re: Using grep to extract domain from email
by hbm (Hermit) on Jan 15, 2009 at 20:54 UTC
    I think you wanted map there:
    my @domains = map { /.+@(.+)/ } @emails;
      Thanks!