[Chicago-talk] detecting whether a scalar is number or a string.
Richard Reina
richard at rushlogistics.com
Tue Jul 8 10:21:40 PDT 2008
Tnank you very much Steve.
Nice solution.
---- Chicago.pm chatter <chicago-talk at pm.org> wrote:
>
>
> > my $string = "anssds";
> >
> > and
> >
> > $string = "5879873454";
>
> use Scalar::Util qw( looks_like_number );
>
> if( looks_like_number $scalar )
> {
> # perl will do math on it.
> }
> else
> {
> # perl will not do math on it.
> }
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
>
More information about the Chicago-talk
mailing list