[Chicago-talk] detecting whether a scalar is number or a string.

Shawn Carroll shawn.c.carroll at gmail.com
Sun Jul 6 12:57:24 PDT 2008


On Sun, Jul 6, 2008 at 2:48 PM, Richard Reina <richard at rushlogistics.com> wrote:
> Hello and Happy Sunday to All,
>
> Can someone tell me please how I can test whether a string is number or not.
>
> so to differentiate from:
>
> my $string = "anssds";
>
> and
>
> $string = "5879873454";
>
> Thanks for your attention.  Have a great day!
> _______________________________________________

$string =~ m/[:digit:]/;
-or-
$string =~ m/[:alpha:];

-- 
shawn.c.carroll at gmail.com
Perl Programmer
Soccer Referee


More information about the Chicago-talk mailing list