in reply to Re: regular expression with @@/
in thread regular expression with @@/

Both \Q and \ will escape @

No, \Q doesn't:

$ perl -wle'print q{@@x} =~ m|\A\Q@@x\E\z| ? "match" : "no match"' Possible unintended interpolation of @x in string at -e line 1. Name "main::x" used only once: possible typo at -e line 1. no match $ perl -wle'print q{@@x} =~ m|\A@\@x\z| ? "match" : "no match"' match

Replies are listed 'Best First'.
Re^3: regular expression with @@/
by ikegami (Patriarch) on Dec 07, 2009 at 19:38 UTC
    ah, interesting!
    $ perl -le'@@=qw( a b ); print qr|\Q@@|' (?-xism:\@\@) $ perl -le'@@=qw( a b ); print qr|@@|' (?-xism:@@) $ perl -le'@a=qw( a b ); print qr|\Q@a|' (?-xism:a\ b)

    I knew something was hinky with what I had posted.