$id =~ s/\s+$//g; $id =~ s/^\s+//g;
The /g option means "global" but the anchors mean only at the beginning or end so remove the /g option.
elsif($id =~ /^.*\@\w+\.com|org|net/)
That says to match the pattern ^.*\@\w+\.com OR the pattern org OR the pattern net. You need parentheses to group the alternation correctly:
elsif($id =~ /^.*\@\w+\.(?:com|org|net)/)
In reply to Re: Validate email id
by jwkrahn
in thread Validate email id
by tart
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |