Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: The mystery of double bitwise negation

by BrowserUk (Patriarch)
on Jul 12, 2015 at 18:04 UTC ( #1134411=note: print w/replies, xml ) Need Help??


in reply to The mystery of double bitwise negation

I'd say that the first one was completely pointless. Double bit-wise inversion of the constant 1 serves no purpose at all:

C:\test>perl -MDevel::Peek -le" my($m,$n) = (1,~~1); print Dump($m), ' + ', Dump( $n )" SV = IV(0x2ca374) at 0x15501c REFCNT = 1 FLAGS = (PADBUSY,PADMY,IOK,pIOK) IV = 1 SV = IV(0x2ca378) at 0x155010 REFCNT = 1 FLAGS = (PADBUSY,PADMY,IOK,pIOK) IV = 1

The second is a golfed version of scalar. Why? No idea.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1134411]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2022-05-25 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (90 votes). Check out past polls.

    Notices?