Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Test for Number or String

Expand Messages
  • Charles K. Clarkson
    Mike Dillinger queried: [snip] ... use POSIX; my $test = 7000_000_003; print isdigit( $test ) ? numeric n : string n ; HTH, Charles
    Message 1 of 3 , May 2, 2002
    • 0 Attachment
      "Mike Dillinger" <miked@...> queried:

      [snip]
      : Is there an easier way to test for numeric stuff?
      : I know C has isnum or isdigit or something like that,
      : and it would be cool if PERL had a function like that
      : rather than doing a regexp test. I'm also open to
      : suggestions on how to test for numeric responses
      : that you might have.

      use POSIX;
      my $test = 7000_000_003;
      print isdigit( $test ) ? "numeric\n" : "string\n";


      HTH,

      Charles K. Clarkson
      --
      Head Bottle Washer,
      Clarkson Energy Homes, Inc.

      CJ Web Work - Domains for Real Estate Investors.
      E Pluribus Unum -- One from many.
    Your message has been successfully submitted and would be delivered to recipients shortly.