@_ is indeed something perl groks natively (it's the argument list passed to a subroutine); and variables are interpolated into regular expressions. So, as written, your surmise about what's going wrong is correct; but shift those characters around (follow @ with anything else), and you probably wouldn't have seen just the problem you're seeing.
I don't see why perl would complain about an uninitialized value if the *only* change you made was escaping the @.
Now, to switch gears: this regex ain't gonna match email addresses. With the * following the character class it's just looking for ZERO OR MORE letters, digits, etc., so even "" is going to match.
Even if you change that * to a +, you're still not going to match anything like the range of valid email addresses "0", "@" all by themselves will match with that change.
There are lots of threads on this site about validating email addresses; matching the strings is a common thing people try to do in Perl, but there's no really simple way (see perlfaq9). That said, you might look into Email::Valid, Email::Find, or, if you really wanna do it with a regex, see the informative Re: pattern match e-mail addresses.
Philosophy can be made out of anything. Or less -- Jerry A. Fodor
In reply to Re: @ in regex, or not?
by arturo
in thread @ in regex, or not?
by JPaul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |