diff options
author | Michael G Schwern <schwern@pobox.com> | 2005-07-14 09:57:45 -0700 |
---|---|---|
committer | Steve Hay <SteveHay@planit.com> | 2005-07-15 09:04:57 +0000 |
commit | a44e5664a991fdadec2f1aada7ad25ce3323e639 (patch) | |
tree | 091586e0c56feb8b85b66dda6ddf55926be87288 /pod/perlop.pod | |
parent | 85d8b7d5cda435e10eacfec2d20f2936bdf7ca3a (diff) | |
download | perl-a44e5664a991fdadec2f1aada7ad25ce3323e639.tar.gz |
[perl #7840] Hash Behaviour differs v5.6.0 to v5.6.1
From: "Michael G Schwern via RT" <perlbug-followup@perl.org>
Message-ID: <rt-3.0.11-7840-117401.4.81505529800216@perl.org>
(with minor tweaks)
p4raw-id: //depot/perl@25149
Diffstat (limited to 'pod/perlop.pod')
-rw-r--r-- | pod/perlop.pod | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod index 04e1b48036..f7ff074533 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<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, |