develooper Front page | perl.perl5.porters | Postings from May 2003

[PATCH] [perl #8702] Clean up perltrap mis-information

Thread Next
From:
Casey West
Date:
May 9, 2003 08:05
Subject:
[PATCH] [perl #8702] Clean up perltrap mis-information
Message ID:
20030509150939.GN49820@geeknest.com
http://rt.perl.org/rt2/Ticket/Display.html?id=8702

This patch will make perltrap perfectly clear in this situation.

  Casey West

-- 
"The wireless music box has no imaginable commercial value. Who would
pay for a message sent to nobody in particular?"
 -- David Sarnoff's associates in response to his urgings for
    investment in the radio in the 1920s.

--- perl-current.orig/pod/perltrap.pod  Sun Apr 21 13:33:55 2002
+++ perl-current/pod/perltrap.pod       Fri May  9 11:03:05 2003
@@ -1436,12 +1436,25 @@
 
 =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
 

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