[Perl-unix-users] Re: determining if a scalar is an integer or not

2003-01-30 Thread Mark
- Original Message - From: "Thomas_M" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, January 30, 2003 2:35 PM Subject: RE: determining if a scalar is an integer or not > > another way is to use a regex and check i

[Perl-unix-users] RE: determining if a scalar is an integer or not

2003-01-30 Thread Thomas_M
> another way is to use a regex and check if the var only > consists numbers: > > if ($var1 =~ /^\d+$/) { > print "is int\n"; > } else { > print "not int" > } How about -7 or 5.0? Both are integers. Wouldn't it be better for him to use one of the answers in the FAQ? http://www.perl