Re: int or float

2003-01-08 Thread John W. Krahn
Jerry Preston wrote: > > Hi! Hello, > I am looking for a simple way to figure out if a value is a integer or a > float. How to tell the difference between 7 and 7.5. $ perl -le' for ( 7, 5.9 ) { print "$_ is an integer" if $_ == int; } ' 7 is an integer Also have a look at this FAQ:

Re: int or float

2003-01-08 Thread Rob Dixon
Hi Jerry Just check for the existence of a decimal point: if ($n =~ /\./) { print "Floating point\n" } else { print "Integer\n" ); ( This will work even if you have assigned $n = 7.000, but assumes that $n is at least numeric and isn't so large or small that it's in scientific notation )

int or float

2003-01-08 Thread Jerry Preston
Hi! I am looking for a simple way to figure out if a value is a integer or a float. How to tell the difference between 7 and 7.5. Thanks, Jerry