$mail =~ /(.*?)\@/; my $first_part = $1; # better do some error-handling first ;-)