qr//
is one of the quote-like operators that apply to pattern matching and related activities.
From perldoc:
This operator quotes (and possibly compiles) its STRING as a regular expression. STRING is interpolated the same way as PATTERN in m/PATTERN/. If '
is used as the delimiter, no interpolation is done.
From modern_perl:
The qr// operator creates first-class regexes. Interpolate them into the match operator to use them:
my $hat = qr/hat/;
say 'Found a hat!' if $name =~ /$hat/;
... or combine multiple regex objects into complex patterns:
my $hat = qr/hat/;
my $field = qr/field/;
say 'Found a hat in a field!'
if $name =~ /$hat$field/;
like( $name, qr/$hat$field/,
'Found a hat in a field!' );