It really depends on the use case, you haven't been too clear about this.
What I've shown is a kind of exception handling, (the difference to hippo's solution being that it is only catching warnings and not fatals)
That's ok if you want to monitor complicated code or volatile input.
Or if you have to deal with different unpredictable warnings.
> So, what do you think of my sub?
In this particular case I (like the others replying) have problems to see the advantage over Scalar::Util 's looks_like_number().
Unless you can show a case where the latter fails to avoid the warning.
And you should at least check which warnings were triggered.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
In reply to Re^3: How to capture the "isn't numeric" warning?
by LanX
in thread How to capture the "isn't numeric" warning?
by harangzsolt33
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |