in reply to Re^2: How to capture the "isn't numeric" warning?
in thread How to capture the "isn't numeric" warning?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to capture the "isn't numeric" warning?
by harangzsolt33 (Deacon) on Jun 15, 2019 at 16:14 UTC | |
by tobyink (Canon) on Jun 16, 2019 at 11:28 UTC | |
by LanX (Saint) on Jun 16, 2019 at 12:43 UTC | |
by choroba (Cardinal) on Jun 16, 2019 at 12:45 UTC | |
by LanX (Saint) on Jun 16, 2019 at 12:52 UTC | |
by LanX (Saint) on Jun 15, 2019 at 16:34 UTC |