Simple Negative Number Checking Subroutine in Perl

pradeep's Avatar author of Simple Negative Number Checking Subroutine in Perl
This is an article on Simple Negative Number Checking Subroutine in Perl in Perl.
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;
     }
 }