in reply to How to check Inputs if Numeric
you could use Scalar::Utils looks_like_number:
Edit: "enhanced" the code-snippet, declaring the tested variable...use Scalar::Util qw(looks_like_number); my $myval = someKindOfUserInput(); # jepp, I'm mostly into java here @ +work ,) [...] if (looks_like_number($myval)) { # a number, maybe even Inf or somesuch thing } [...]
regards,
tomte
Hlade's Law:
If you have a difficult task, give it to a lazy person --
they will find an easier way to do it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to check Inputs if Numeric
by Anonymous Monk on Aug 29, 2014 at 09:07 UTC | |
by carolw (Sexton) on Aug 29, 2014 at 12:50 UTC | |
by Athanasius (Cardinal) on Aug 29, 2014 at 14:12 UTC |