http://qs321.pair.com?node_id=11124426


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 (Archbishop) 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