[perl #8702] Clean up perltrap mis-information
authorCasey West <casey@geeknest.com>
Fri, 9 May 2003 11:09:39 +0000 (07:09 -0400)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Fri, 9 May 2003 19:34:30 +0000 (19:34 +0000)
Message-ID: <20030509150939.GN49820@geeknest.com>

p4raw-id: //depot/perl@19464

pod/perltrap.pod

index d06f84f..835f879 100644 (file)
@@ -1435,13 +1435,26 @@ perl4 programs which unconsciously rely on the bugs in earlier perl versions.
 
 =item * Interpolation
 
-You also have to be careful about array references.
+You also have to be careful about array and hash brackets during
+interpolation.
+
+    print "$foo["
+
+    perl 4 prints: [
+    perl 5 prints: syntax error
 
     print "$foo{"
 
     perl 4 prints: {
     perl 5 prints: syntax error
 
+Perl 5 is expecting to find an index or key name following the respective
+brackets, as well as an ending bracket of the appropriate type.  In order
+to mimic the behavior of Perl 4, you must escape the bracket like so.
+
+    print "$foo\[";
+    print "$foo\{";
+
 =item * Interpolation
 
 Similarly, watch out for: