Many times we need to check whether a number is negative or not, here is a very simple subroutine to do that.
Code: Perl
sub isNegative
{
my($checkValue) = @_;
if(abs($checkValue) != $checkValue)
{
# the value is negative
return 1;
}
else
{
# number is positive
return 0;
}
}