From: Rafael Garcia-Suarez Date: Sun, 13 Mar 2005 11:07:40 +0000 (+0000) Subject: Doc patches to clarify the stringification rules of {} and => X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=719b43e8a7892cfc854b9123fcad88c53828b0b9;p=p5sagit%2Fp5-mst-13.2.git Doc patches to clarify the stringification rules of {} and => by Jarkko (bug #34419) p4raw-id: //depot/perl@24033 --- diff --git a/pod/perldata.pod b/pod/perldata.pod index 254304c..1b02b1e 100644 --- a/pod/perldata.pod +++ b/pod/perldata.pod @@ -336,8 +336,9 @@ In fact, an identifier within such curlies is forced to be a string, as is any simple identifier within a hash subscript. Neither need quoting. Our earlier example, C<$days{'Feb'}> can be written as C<$days{Feb}> and the quotes will be assumed automatically. But -anything more complicated in the subscript will be interpreted as -an expression. +anything more complicated in the subscript will be interpreted as an +expression. This means for example that C<$version{2.0}++> is +equivalent to C<$version{2}++>, not to C<$version{'2.0'}++>. =head3 Version Strings diff --git a/pod/perlop.pod b/pod/perlop.pod index aa0e339..7c96ee0 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -688,9 +688,13 @@ In list context, it's just the list argument separator, and inserts both its arguments into the list. The C<< => >> operator is a synonym for the comma, but forces any word -to its left to be interpreted as a string (as of 5.001). It is helpful -in documenting the correspondence between keys and values in hashes, -and other paired elements in lists. +(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. + +The C<< => >> operator is helpful in documenting the correspondence +between keys and values in hashes, and other paired elements in lists. =head2 List Operators (Rightward)