perlop: why \c\ cannot be placed just before the terminating delimiter
[p5sagit/p5-mst-13.2.git] / pod / perlop.pod
index b86dda4..ba2ff9f 100644 (file)
@@ -689,13 +689,30 @@ both its arguments into the list.
 
 The C<< => >> operator is a synonym for the comma, but forces any word
 (consisting entirely of word characters) to its left to be interpreted
-as a string (as of 5.001).  If the argument on the left is not a word,
-it is first interpreted as an expression, and then the string value of
-that is used.
+as a string (as of 5.001).  This includes words that might otherwise be
+considered a constant or function call.
+
+    use constant FOO => "something";
+
+    my %h = ( FOO => 23 );
+
+is equivalent to:
+
+    my %h = ("FOO", 23);
+
+It is I<NOT>:
+
+    my %h = ("something", 23);
+
+If the argument on the left is not a word, it is first interpreted as
+an expression, and then the string value of that is used.
 
 The C<< => >> operator is helpful in documenting the correspondence
 between keys and values in hashes, and other paired elements in lists.
 
+        %hash = ( $key => $value );
+        login( $username => $password );
+
 =head2 List Operators (Rightward)
 
 On the right side of a list operator, it has very low precedence,
@@ -1651,6 +1668,11 @@ Because the slash that terminated C<m//> was followed by a C<SPACE>,
 the example above is not C<m//x>, but rather C<m//> with no C</x>
 modifier.  So the embedded C<#> is interpreted as a literal C<#>.
 
+Also no attention is paid to C<\c\> during this search.
+Thus the second C<\> in C<qq/\c\/> is interpreted as a part of C<\/>,
+and the following C</> is not recognized as a delimiter.
+Instead, use C<\034> or C<\x1c> at the end of quoted constructs.
+
 =item Removal of backslashes before delimiters
 
 During the second pass, text between the starting and ending
@@ -1987,7 +2009,8 @@ depending on context.  This distinction is determined on syntactic
 grounds alone.  That means C<< <$x> >> is always a readline() from
 an indirect handle, but C<< <$hash{key}> >> is always a glob().
 That's because $x is a simple scalar variable, but C<$hash{key}> is
-not--it's a hash element.
+not--it's a hash element.  Even C<< <$x > >> (note the extra space)
+is treated as C<glob("$x ")>, not C<readline($x)>.
 
 One level of double-quote interpretation is done first, but you can't
 say C<< <$foo> >> because that's an indirect filehandle as explained