A solution with Try::Tiny:
#!/usr/bin/env perl use strict; use warnings; use Try::Tiny; my $X = "abc"; try { use warnings FATAL => 'numeric'; $X = int($X); } catch { $X = "This should have been a number"; }; print $X;
In reply to Re: How to capture the "isn't numeric" warning?
by hippo
in thread How to capture the "isn't numeric" warning?
by harangzsolt33
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |