On Sun, 7 Oct 2001 12:27:17 +1000 (EST), Damian Conway wrote: >The step you're missing is that the non-numeric string "hello", >when evaluated in a numeric context, produces NaN. So: > > "hello" == 0 && 0 != NaN > >is: > > Nan == 0 && 0 != NaN > >which is false.
So to what does "123foo" evaluate in numeric context? Now, it produces 123. Which is probably useful... if "123foo" produces Nan, which wouldn't really surprise me too much, we'll need additional tools to extract the number from a string. We can do it with a regex, but for the general case, it becomes a nasty beast of a regex, and I don't want to rewrite it from scratch every time I need it. A job for Regexp::Common? -- Bart.