- or download this
# First make the program know the two numbers:
$Number1 = 48;
...
$Result = $Number1 / $Number2;
# ...and look if we got a decimal:
- or download this
# Using your sub
is_integer_string($Result)
...
# Check if the number is the same as its integer part:
$Result == int($Result)
- or download this
if (condition) { print "Yes"; } else { print "No"; }
- or download this
sub is_integer_string {
my $N = $_[0] + 0;
return $N =~ /^\-?\d+$/;
}