develooper Front page | perl.perl5.porters | Postings from February 2018

[perl #132908] String/Number interpretation of a string

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
February 25, 2018 22:10
Subject:
[perl #132908] String/Number interpretation of a string
Message ID:
rt-4.0.24-2063-1519596641-943.132908-15-0@perl.org
On Sun, 25 Feb 2018 18:25:19 GMT, perl@ton.iguana.be wrote:
> 
> This is a bug report for perl from perl@ton.iguana.be,
> generated with the help of perlbug 1.40 running under perl 5.20.2.
> 
> 
> -----------------------------------------------------------------
> [Please describe your issue here]
> 
> perl -wlE '$_="-4-5"; say -$_|0'
> Argument "+4-5" isn't numeric in bitwise or (|) at -e line 1.
> 4
> 
> perl -wlE '$_=-4 . -5; say -$_|0'
> Argument "+4-5" isn't numeric in bitwise or (|) at -e line 1.
> 4
> 
> perl -wlE '$_="-4-5"; $_+0; say -$_|0'
> Useless use of addition (+) in void context at -e line 1.
> Argument "-4-5" isn't numeric in addition (+) at -e line 1.
> Argument "+4-5" isn't numeric in bitwise or (|) at -e line 1.
> 4
> 
> perl -wlE '$_=-4 . -5; $_+0; say -$_|0'
> Useless use of addition (+) in void context at -e line 1.
> Argument "-4-5" isn't numeric in addition (+) at -e line 1.
> 18446744073709551612
> 
> That last one is very unexpected.
> The same thing happens on perl 5.26.1
> 

I do not get the same results as you.

#####
$ perl -v | head -2 | tail -1
This is perl 5, version 20, subversion 3 (v5.20.3) built for x86_64-linux

$ perl -wlE '$_="-4 . -5"; $_+0; say -$_|0'
Useless use of addition (+) in void context at -e line 1.
Argument "-4 . -5" isn't numeric in addition (+) at -e line 1.
Argument "+4 . -5" isn't numeric in bitwise or (|) at -e line 1.
4

$ perl -v | head -2 | tail -1
This is perl 5, version 26, subversion 0 (v5.26.0) built for x86_64-linux

$ perl -wlE '$_="-4 . -5"; $_+0; say -$_|0'
Useless use of addition (+) in void context at -e line 1.
Argument "-4 . -5" isn't numeric in addition (+) at -e line 1.
Argument "+4 . -5" isn't numeric in bitwise or (|) at -e line 1.
4
#####

Thank you very much.
-- 
James E Keenan (jkeenan@cpan.org)

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=132908

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About