[PerlChina] how test a string is number?

Formalin Achilles formalin14 at gmail.com
Tue Dec 13 19:47:48 PST 2005


if ($opts{"d"} =~ m/[0-9]+\.?[0-9]*/) {
}


2005/12/14, 黄叶 <hylinux at gmail.com>:
>
> HI, all
> I use the Getopt::Std gather the args from command line.
>
> example:
> #!/usr/bin/perl -w
> use strcit;
> use Getopt::Std;
> my %opts = ();
> getopt("d", \%opts);
>
> print $opts{"d"}
>
> Ok, Now I need a number value about the args named "d", but
> How i test the char is number?
>
> Thanks.
>
>
> _______________________________________________
> China-pm mailing list
> China-pm at pm.org
> http://mail.pm.org/mailman/listinfo/china-pm
>



--
---------------------------
Achilles Xu
http://www.formalin14.org
-------------- next part --------------
q?????!???,r??m??m???????j+??j)r?j??j?r????9?x?M????!???


More information about the China-pm mailing list