Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL qr(expr) Function
Syntax
Definition and Usage
This operator quotes its STRING as a regular expression. STRING is interpolated the same way as PATTERN in m/PATTERN/
Return Value
Example
$rex = qr/my.STRING/is;
s/$rex/foo/;
is is equivalent to
s/my.STRING/foo/is;
|
The result may be used as a subpattern in a match:
$re = qr/$pattern/;
$string =~ /foo${re}bar/; # can be interpolated in other patterns
$string =~ $re; # or used standalone
$string =~ /$re/; # or this way
| |
|

|
|
|