From: Michael G Schwern Date: Thu, 14 Jul 2005 16:57:45 +0000 (-0700) Subject: [perl #7840] Hash Behaviour differs v5.6.0 to v5.6.1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a44e5664a991fdadec2f1aada7ad25ce3323e639;p=p5sagit%2Fp5-mst-13.2.git [perl #7840] Hash Behaviour differs v5.6.0 to v5.6.1 From: "Michael G Schwern via RT" Message-ID: (with minor tweaks) p4raw-id: //depot/perl@25149 --- diff --git a/pod/perlop.pod b/pod/perlop.pod index 04e1b48..f7ff074 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -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: + + 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,