use Scalar::Util 'looks_like_number'; sub is_numeric { local $_=shift; if (!ref $_) { return looks_like_number($_); } }