perldelta: fix the example of lvalue ref from substr
authorRicardo Signes <rjbs@cpan.org>
Sun, 20 May 2012 12:35:04 +0000 (08:35 -0400)
committerRicardo Signes <rjbs@cpan.org>
Sun, 20 May 2012 12:35:04 +0000 (08:35 -0400)
reported by Shlomi Fish

pod/perldelta.pod

index 4ea10e6..3b26bf5 100644 (file)
@@ -116,9 +116,9 @@ their position from the end of the string, affecting code like this:
 
     my $string = "string";
     my $lvalue = \substr $string, -4, 2;
-    print $lvalue, "\n"; # prints "ri"
+    print $$lvalue, "\n"; # prints "ri"
     $string = "bailing twine";
-    print $lvalue, "\n"; # prints "wi"; used to print "il"
+    print $$lvalue, "\n"; # prints "wi"; used to print "il"
 
 The same thing happens with an omitted third argument.  The returned
 lvalue will always extend to the end of the string, even if the string