in reply to left side of pattern matching
Yes, perl interpolates double quoted strings, including regular expression patterns used in the match and substitution operators. The gory details are in: Gory details of parsing quoted constructs.
If you don't want string interpolation you can use single quoted operators:
if ( $hello =~ m'^[ \|\t\r\n]+$' ) {
But then "\t", "\r" and "\n" won't be interpolated.
|
|---|