$mail =~ /(.*?)\@/; my $first_part = $1; # better do some error-handling first ;-)
But better have a look at CPAN for some nice email handling/parsing modules...
HTH, RataIn reply to Re: RegEx to find the index of the character '@' in an Email address
by Ratazong
in thread RegEx to find the index of the character '@' in an Email address
by itsmetom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |