#!/usr/bin/perl use strict; use warnings; use Scalar::Util 1.10 'looks_like_number'; my $total = 4; my $increment = 'blah'; $total += $increment || 0 if looks_like_number( $increment );