qr// documented in perlop in the "Regexp Quote-Like Operators" section.
Just as qq"..." aka "..." allows you to build a string, qr/.../ allows you to create a regular expression.
$s = "abc"; # Creates a string and assigns it to $s $s = qq"abc"; # Same as above. print("$s\n"); $re = qr/abc/; # Creates a compiled regex pattern and assigns it to $x print "match\n" if $s =~ /$re/;
The citation rules for qr/.../ very similar to qq"..." . The only difference is that \ followed by a non-word character is passed unchanged.
source share