summaryrefslogtreecommitdiff
path: root/pod/perlop.pod
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-08-26 05:54:58 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-08-26 08:24:20 -0700
commit4e1988c66359c6a52ff140949f84adc44ae9e484 (patch)
treee9f81941484c7c32c5f7207ca32707ae0f9731c4 /pod/perlop.pod
parent44f645e897e30c5c0b110beef5ec73cdd022b1e9 (diff)
downloadperl-4e1988c66359c6a52ff140949f84adc44ae9e484.tar.gz
[perl #93358] Clarify => quoting
The perlop manpage was stating ‘the left operand’, which was not entirely correct, as ‘time.shift =>’ quotes just the shift, not the time (nor does it see the whole as not being an ident- ifier and refuse to quote anything).
Diffstat (limited to 'pod/perlop.pod')
-rw-r--r--pod/perlop.pod13
1 files changed, 11 insertions, 2 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod
index 9e83c52f82..c0cbe50514 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -872,8 +872,8 @@ In list context, it's just the list argument separator, and inserts
both its arguments into the list. These arguments are also evaluated
from left to right.
-The C<< => >> operator is a synonym for the comma except that it causes
-its left operand to be interpreted as a string if it begins with a letter
+The C<< => >> operator is a synonym for the comma except that it causes a
+word on its left to be interpreted as a string if it begins with a letter
or underscore and is composed only of letters, digits and underscores.
This includes operands that might otherwise be interpreted as operators,
constants, single number v-strings or function calls. If in doubt about
@@ -902,6 +902,15 @@ between keys and values in hashes, and other paired elements in lists.
%hash = ( $key => $value );
login( $username => $password );
+The special quoting behavior ignores precedence, and hence may apply to
+I<part> of the left operand:
+
+ print time.shift => "bbb";
+
+That example prints something like "1314363215shiftbbb", because the
+C<< => >> implicitly quotes the C<shift> immediately on its left, ignoring
+the fact that C<time.shift> is the entire left operand.
+
=head2 List Operators (Rightward)
X<operator, list, rightward> X<list operator>