Change 13017 by ams@lustre on 2001/11/15 12:56:49

        Subject: [PATCH pod/perltrap.pod] Re: Strange syntax error with map
        From: Robin Barker <[EMAIL PROTECTED]>
        Date: Thu, 15 Nov 2001 13:48:34 GMT
        Message-Id: <[EMAIL PROTECTED]>
        (Applied with tweaks.)

Affected files ...

.... //depot/perl/pod/perltrap.pod#26 edit

Differences ...

==== //depot/perl/pod/perltrap.pod#26 (text) ====
Index: perl/pod/perltrap.pod
--- perl/pod/perltrap.pod.~1~   Thu Nov 15 06:00:05 2001
+++ perl/pod/perltrap.pod       Thu Nov 15 06:00:05 2001
@@ -651,6 +651,16 @@
     # perl4 prints: {a}
     # perl5 prints: 2
 
+=item * Parsing
+
+When perl sees C<map {> (or C<grep {>), it has to guess whether the C<{>
+starts a BLOCK or a hash reference. If it guesses wrong, it will report
+a syntax error near the C<}> and the missing (or unexpected) comma.
+
+Use unary C<+> before C<{> on a hash reference, and unary C<+> applied
+to the first thing in a BLOCK (after C<{>), for perl to guess right all
+the time. (See L<perlfunc/map>.)
+
 =back
 
 =head2 Numerical Traps
End of Patch.

Reply via email to