in reply to Re^2: Regex help
in thread Regex help
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):
You'll see a zero in both lines of output.perl -le '$regex = qr:[<>@#$%^&*()_+=|\{\}\[\]\/\\]:; print "$%"; print "$regex";'
|
|---|