#!/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;