SPUG: 0 == undef

Tim Maher tim at consultix-inc.com
Wed Apr 7 14:27:08 CDT 2004

On Wed, Apr 07, 2004 at 12:00:51PM -0700, Peter Darley wrote:
> Tim,
> 	Further examination shows that any non-numeric value==0,

That's true, which is another very good reason to have -w
enabled, to you'll be notified when 0s are substituted for
the non-numeric value. 8-}

> I guess I'll cook up an IsNumber() function and do if
> (IsNumber($Test1) && IsNumber($Test2) && $Test1==$Test2). Or
> perhaps I'll make a function like Equal($Test1, $Test2). None
> of this will help with readability tho. :)

> Any idea why this is set up like this?

Larry has been known to say "AWK has to be better at
(Doesn't really apply here, but I love that quote !)

Maybe the latest Regexp::Common (which I don't have handy)
has a regex to match numbers, otherwise, it's pretty easy
to roll your own (but don't forget leading - signs, and
embedded decimal places).

> Thanks,
> Peter Darley

More information about the spug-list mailing list