in reply to Re^2: Regex help
in thread Regex help

Sorry, but it looks to me like the first reply above got it right. The OP said that if the value of $input was "hello there0", and the regex did not have a backslash in front of the "$" in the character class, the regex would match and yield "not okay" as the output. But this goes against the intent of the regex, which is to match only on the particular set of non-alphanumeric characters -- including "$" and "%".

The OP figured out that putting backslash in front of "$" would make the regex work as intended, but did not understand why, and everybody gave the correct explanation: without the backslash, you get an interpolation of the variable "$%", and its value turns out to be zero. Try this (NB: this uses bash shell style quoting):

perl -le '$regex = qr:[<>@#$%^&*()_+=|\{\}\[\]\/\\]:; print "$%"; print "$regex";'
You'll see a zero in both lines of output.