Link to home
Start Free TrialLog in
Avatar of ramble
rambleFlag for United States of America

asked on

Is it a real number?

I'm looking for a number somewhere between -10000 and 10000.

if (($_ < -9999) || ($_ >9999)) {
     print "\nIt's a number, but out of range\n";
} elsif ($_ >-10000) && ($_ <10000) {
    print "\nPerfect\n";
} elsif ($_ is an alpha/number or just contains alpha) {
    print"\nNumber expected, this contains other characters\n";
} else {print "\nShouldn't get here\n";}

I specifically need to know how to determine if $_ is a number or not.
ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
perldoc -q "How do I determine whether a scalar is a number/whole/integer/float?"
Avatar of ramble

ASKER

Thanks_ramble

Just Ignore the last comment