How to check if a number is integer

hello

I have to check if a $num (number) is a integer or not . How to do with perl please ?

For example the code should return yes if $num=1
and “no” if $num=1.45

Thank you
Graziano

in your example this would be simple:

if (/\\D/) {
   is not an integer
}

the regular expression checks if there are any non-digit characters in the string. Since there is a dot it returns true and the string is not an integer. But that might be too simple minded for your real data, in that case see the perl FAQs:

How do I determine whether a scalar is a number/whole/finteger/float

There is also a module(s) that the above link mentions you can use.