In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/da2f94c54905de8d600063fdd63a3a6b76d27616?hp=a5b92898b77edcbff06468ccf67150e50d1703e4>
- Log ----------------------------------------------------------------- commit da2f94c54905de8d600063fdd63a3a6b76d27616 Author: Father Chrysostomos <spr...@cpan.org> Date: Mon Oct 4 08:33:31 2010 -0700 perlop.pod: Clarify -âs string/number distinction M pod/perlop.pod commit 94824daa35eb9acedff60f3e3d5098b75407327b Author: Father Chrysostomos <spr...@cpan.org> Date: Mon Oct 4 08:29:12 2010 -0700 perldelta for [perl #57706] M pod/perldelta.pod ----------------------------------------------------------------------- Summary of changes: pod/perldelta.pod | 6 ++++++ pod/perlop.pod | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pod/perldelta.pod b/pod/perldelta.pod index bfe0eb4..ef58531 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -125,6 +125,12 @@ longer inherit directory handles from their parent threads. Such programs would probably have crashed anyway L<[perl #75154]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=75154>. +=head2 Negation treats strings differently from before + +The unary negation operator C<-> now treats strings that look like numbers +as numbers +L<[perl #57706]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=57706>. + =head1 Deprecations XXX Any deprecated features, syntax, modules etc. should be listed here. diff --git a/pod/perlop.pod b/pod/perlop.pod index c99f672..707df4a 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -194,11 +194,12 @@ Unary "!" performs logical negation, i.e., "not". See also C<not> for a lower precedence version of this. X<!> -Unary "-" performs arithmetic negation if the operand is numeric. If -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 +Unary "-" performs arithmetic negation if the operand is numeric, +including any string that looks like a number. If 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". If, however, the string begins with a non-alphabetic character (excluding "+" or "-"), Perl will attempt to convert the string to a numeric and the arithmetic negation is performed. If the -- Perl5 Master Repository