On Sat, Apr 13, 2002 at 08:25:06AM -0700, Randal L. Schwartz wrote:
> >>>>> "Randal" == Randal L Schwartz <[EMAIL PROTECTED]> writes:
>
> >>>>> "Jeff" == Jeff Zucker <[EMAIL PROTECTED]> writes:
> Jeff> * skipped 2 of the subtests on neat() which depend on
> Jeff> looks_like_number() telling the difference between "2"
> Jeff> and 2
>
> Randal> This *is* possible in Pure Perl. Depends on the property that a
> Randal> string that hasn't been used in a numeric context reacts differently
> Randal> to the bit operators. The exact idiom escapes me at the moment, but I
> Randal> *could* find it if properly prodded.
>
> Found it after playing around for a few minutes. I hope this is it, anyway:
>
> sub is_numeric {
> ($_[0] & ~ $_[0]) eq "0";
> }
>
> Returns true for 2, false for "2".
Excellent, thanks Randal.
Tim.