Reputation: 23
When i use the line :
if (m/^$END$/g) {
# ...
}
in my code, the compiler thinks that I am searching for a Static'END$' in my code, whereas I want to search the string "$END$". How shall I go about it?
Upvotes: 1
Views: 113
Reputation: 118128
if (/\A\Q $END$ /x) { ... }
\Q
Disable pattern metacharacters until\E
Removed the /g
that shouldn't be there.
Upvotes: 0
Reputation: 57470
To match a literal $
, just escape it with a backslash:
if (m/^\$END\$/) { ... }
Removed the /g
that shouldn't be there.
Upvotes: 4