diff options
author | Steve Peters <steve@fisharerojo.org> | 2005-12-17 15:35:45 +0000 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2005-12-17 15:35:45 +0000 |
commit | 8705167b57c0f17d383e9e8ced641c8a486046b2 (patch) | |
tree | 6abd18749a02af0716669e9581e8b4054b4f3ea6 /pod/perlop.pod | |
parent | 4ea1d5509b412a58fa64cd5ebc1ea31750b05303 (diff) | |
download | perl-8705167b57c0f17d383e9e8ced641c8a486046b2.tar.gz |
Addition documentation explaining aritmetic negation on strings. Also,
additional test cases based partially on code by Piotr Fusik in
RT #36675: -'-10' eq '+10'.
p4raw-id: //depot/perl@26387
Diffstat (limited to 'pod/perlop.pod')
-rw-r--r-- | pod/perlop.pod | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod index d0b4c640de..6afe47387c 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -199,7 +199,11 @@ the operand is an identifier, a string consisting of a minus sign concatenated with the identifier is returned. Otherwise, if the string starts with a plus or minus, a string starting with the opposite sign is returned. One effect of these rules is that -bareword is equivalent -to the string "-bareword". +to the string "-bareword". If, however, the string begins with a +non-alphabetic characters, Perl will attempt to convert the string to a numeric +and the arithmetic negation is performed. If the string cannot be cleanly +converted to a numeric, Perl will give the warning B<Argument "the string" +isn't numeric in negation (-) at ...>. X<-> X<negation, arithmetic> Unary "~" performs bitwise negation, i.e., 1's complement. For |