Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: 02.5 == 25 - WTF?

by Eily (Monsignor)
on Nov 30, 2020 at 23:21 UTC ( #11124426=note: print w/replies, xml ) Need Help??


in reply to Re: 02.5 == 25 - WTF?
in thread 02.5 == 25 - WTF?

Both operators work though.

say '==' if 02.5 == 25; say 'eq' if 02.5 eq 25;
prints both == and eq (not that it's surprising either, given perl's seemless conversion between strings and numbers)

Replies are listed 'Best First'.
Re^3: 02.5 == 25 - WTF?
by syphilis (Bishop) on Nov 30, 2020 at 23:54 UTC
    prints both == and eq

    Yes - though making assumptions about equivalence based on the output of perl's print() function is not a good practice.
    For example:
    C:\>perl -le "print sqrt(2);" 1.4142135623731 C:\>perl -le "print 'WTF' unless sqrt(2) == 1.4142135623731;" WTF
    Cheers,
    Rob

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2021-10-18 10:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (73 votes). Check out past polls.

    Notices?