develooper Front page | perl.perl5.porters | Postings from March 2007

[PATCH] perlfunc.pod (ref results), perlop.pod (qr// result)

Thread Next
From:
Wolfgang Laun
Date:
March 14, 2007 00:46
Subject:
[PATCH] perlfunc.pod (ref results), perlop.pod (qr// result)
Message ID:
45F79CAD.5050005@thalesgroup.com
grepping for "LVALUE" and "Regexp" in pod/*.pod didn't produce
anything useful, so here are two trivial patches, explaining
ref() results introduced since 5.6(?), and, somewhat related,
the quality of the qr// result.

Wolfgang

--- pod/perlfunc.pod.old        2007-01-24 12:36:58.000000000 +0100
+++ pod/perlfunc.pod    2007-03-14 07:29:09.000000000 +0100
@@ -4414,6 +4414,14 @@
        print "r is not a reference at all.\n";
     }
 
+The return value C<LVALUE> indicates a reference to an lvalue that is not
+a variable. You get this from taking the reference of function calls like
+C<pos()> or C<substr()>. C<VSTRING> is returned if the reference points
+to a L<version string|perldata\"Version Strings">.
+
+The result C<Regexp> indicates that the argument is a regular expression
+resulting from C<qr//>.
+
 See also L<perlref>.
 
 =item rename OLDNAME,NEWNAME
--- pod/perlop.pod.old  2007-03-14 07:38:09.000000000 +0100
+++ pod/perlop.pod      2007-03-14 07:47:37.000000000 +0100
@@ -1288,11 +1288,15 @@
 expression.  I<STRING> is interpolated the same way as I<PATTERN>
 in C<m/PATTERN/>.  If "'" is used as the delimiter, no interpolation
 is done.  Returns a Perl value which may be used instead of the
-corresponding C</STRING/imosx> expression.
+corresponding C</STRING/imosx> expression. The returned value is a
+normalized version of the original pattern. It magically differs from
+a string containing the same characters: ref(qr/x/) returns "Regexp",
+even though dereferencing the result returns undef.
 
 For example,
 
     $rex = qr/my.STRING/is;
+    print $rex;                 # prints (?si-xm:my.STRING)
     s/$rex/foo/;
 
 is equivalent to



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About