diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-15 07:35:29 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-15 07:35:29 +0000 |
commit | 3ad0bb87e2c7978cb8f4f2a616e86174b8b27b9a (patch) | |
tree | 3e62bc74e77ff24ded126c2a72b4512f7f420b94 /pod | |
parent | ea0cf9a3a7576946b7daa8815f6d5a5e5e67976c (diff) | |
download | perl-3ad0bb87e2c7978cb8f4f2a616e86174b8b27b9a.tar.gz |
minor tweaks to docs on qr//
p4raw-id: //depot/perl@1513
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perldelta.pod | 4 | ||||
-rw-r--r-- | pod/perlop.pod | 11 | ||||
-rw-r--r-- | pod/perlre.pod | 2 |
3 files changed, 11 insertions, 6 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod index e271e7dd2e..d3fbae5b87 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -251,9 +251,9 @@ has been seen. =head2 New C<qr//> operator The C<qr//> operator, which is syntactically similar to the other quote-like -operators, is used to create compiled regular expressions. This compiled +operators, is used to create precompiled regular expressions. This compiled form can now be explicitly passed around in variables, and interpolated in -other regular expressions. See L<perlop> and L<perlre>. +other regular expressions. See L<perlop>. =head2 C<our> is now a reserved word diff --git a/pod/perlop.pod b/pod/perlop.pod index 07ff51ac21..3de295faf7 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -913,7 +913,8 @@ A string which is (possibly) interpolated and then compiled as a regular expression. The result may be used as a pattern in a match $re = qr/$pattern/; - $string =~ /$re/; + $string =~ /foo${re}bar/; # can be interpolated in other patterns + $string =~ $re; # or used standalone Options are: @@ -923,8 +924,9 @@ Options are: s Treat string as single line. x Use extended regular expressions. -The benefit from this is that the pattern is compiled into an internal -representation by the C<qr//> operator and not by the match operator. +The benefit from this is that the pattern is precompiled into an internal +representation, and does not need to be recompiled every time a match +is attempted. This makes it very efficient to do something like: foreach $pattern (@pattern_list) { my $re = qr/$pattern/; @@ -935,6 +937,9 @@ representation by the C<qr//> operator and not by the match operator. } } +See L<perlre> for additional information on valid syntax for STRING, and +for a detailed look at the semantics of regular expressions. + =item qx/STRING/ =item `STRING` diff --git a/pod/perlre.pod b/pod/perlre.pod index c72a71c0ac..fc4d969466 100644 --- a/pod/perlre.pod +++ b/pod/perlre.pod @@ -7,7 +7,7 @@ perlre - Perl regular expressions This page describes the syntax of regular expressions in Perl. For a description of how to I<use> regular expressions in matching operations, plus various examples of the same, see discussion -of C<m//>, C<s///>, and C<??> in L<perlop/Regexp Quote-Like Operators>. +of C<m//>, C<s///>, C<qr//> and C<??> in L<perlop/Regexp Quote-Like Operators>. The matching operations can have various modifiers. The modifiers that relate to the interpretation of the regular expression inside |