in reply to When is a 2 not a 2?

Yes, you're missing the fact that IEEE floating point numbers aren't exact representations.

Update: See for instance Equality checking for strings AND numbers for links and discussion.

Another Update: After actually running it and poking with Devel::Peek this is strange because that's showing a 2 for the NV part.

DB<8> x Dump( $x ) SV = PVNV(0x8e98f0) at 0x800e64 REFCNT = 2 FLAGS = (PADBUSY,PADMY,NOK,POK,pIOK,pNOK,pPOK) IV = 2 NV = 2 PV = 0x435c40 "2"\0 CUR = 1 LEN = 36 empty array

More poking: If you look at the number the representation's different under the hood, so it's definitely a float precision issue somewhere.

DB<11> x unpack( "h*", pack( "F", 2 ) ) 0 0000000000000004 DB<12> x unpack( "h*", pack( "F", $x ) ) 0 2000000000000004

The cake is a lie.
The cake is a lie.
The cake is a lie.