in reply to Re: Disabling Variable Expansion in regular expressions. (single quotes as delimiters)
in thread Disabling Variable Expansion in regular expressions.

hmm ... either it's buggy or I'm doing something wrong

$ perl print '$x' =~ m'$x' __END__ $

EDIT:

darn, the $ becomes an anchor for end-of-line

DB<8> use re 'debug'; '$a' =~ m'$a' Compiling REx "$a" Final program: 1: SEOL (2) 2: EXACT <a> (4) 4: END (0) anchored "a" at 0 (checking anchored) minlen 1

unfortunate!

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

  • Comment on Re^2: Disabling Variable Expansion in regular expressions. (single quotes as delimiters)
  • Select or Download Code

Replies are listed 'Best First'.
Re^3: Disabling Variable Expansion in regular expressions. (single quotes as delimiters)
by Anonymous Monk on May 23, 2019 at 20:16 UTC

    Rolf

    Sadly, my testing shows this is a valid indicator. Perl had no trouble with a pattern that had text past the end of string indicator. Though this is the mechanism I was looking for, it didn't produce the result I expected.

    Thank you so much for your help. It was exactly what I wanted, just not what I needed.

Re^3: Disabling Variable Expansion in regular expressions. (single quotes as delimiters)
by Anonymous Monk on May 23, 2019 at 18:57 UTC

    Rolf,

    But that is precisely the outcome I am looking for. I want to detect the improper use of the $. This hard quoted form seems to be the answer I am looking for.