Might be better to use `if (defined $_ and $_ =~ /^\d+$/)`