in reply to Re^2: trouble with @ in a regular expression
in thread trouble with @ in a regular expression

Good catch! + +

Note that it's the invocation of strict and warnings (-w) that illuminates my error.

Replies are listed 'Best First'.
Re^4: trouble with @ in a regular expression
by AnomalousMonk (Archbishop) on Mar 30, 2012 at 12:57 UTC

    Even with warnings and strictures, Perl is quite happy with an @ if it cannot possibly be a variable.

    >perl -wMstrict -le "my $s = 'foo@bar'; print 'No need to escape lone @ in regex' if $s =~ /@ bar/x; " No need to escape lone @ in regex