Depending on the eventual design of your program and the format of your input file (for example, if the number you are looking for changes a lot in format as integer, floating point, etc), you might find useful the module: Scalar::Util.
Have a look at the following node:
Checking whether a value is numeric or not