>>>>> "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".

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply via email to