in reply to Re^2: using constants in regex/search
in thread using constants in regex/search

That's identical to
if ($input =~ /$NAME/) {...}
which is what I used, so I don't get your point.

Replies are listed 'Best First'.
Re^4: using constants in regex/search
by spmlingam (Scribe) on Dec 03, 2008 at 07:59 UTC
    You have copied the NAME value to a variable and used as $NAME.
    i have specified a method, which will use the constant NAME itself in the regular expression
    use strict; use constant NAME => 'abc'; if ($ARGV[0] =~ /${\NAME}/) { print "match"; };
      You're sure you didn't update your post? I know about the difference between ${NAME} and ${\NAME}, and when replying, I checked to make sure there wasn't a \ there.
        i am updated my post
        Still you can access constant 'abc' in regular expression like ${NAME} without "use strict".
        While using the "use strict", this needs to be escaped.
        "use strict" is important.
Re^4: using constants in regex/search
by ikegami (Patriarch) on Dec 03, 2008 at 08:27 UTC
    You're thinking of ${NAME}. ${\NAME} is the scalar version of @{[ NAME ]}.