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

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

Thread Previous
From:
James E Keenan via RT
Date:
February 26, 2018 13:36
Subject:
[perl #132908] String/Number interpretation of a string
Message ID:
rt-4.0.24-2051-1519652182-1563.132908-15-0@perl.org
On Mon, 26 Feb 2018 11:39:05 GMT, abigail@abigail.be wrote:
> On Sun, Feb 25, 2018 at 02:10:41PM -0800, James E Keenan via RT wrote:
> > 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.
> 
> 
> Is that because you're using different code, or because of something else?
> 
> 
> > 
> > #####
> > $ 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'
> 
> That's not the same as written in the bug report:
> 
> > > perl -wlE '$_=-4 . -5; $_+0; say -$_|0'
> 
> Note the absense of quotes around C<< -4 . -5 >> in the report,
> while your code puts quotes there.
> 

You are correct.  Please ignore my previous post.

> > 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
> 
> 
> 
> Abigail

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

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

Thread Previous


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