Sound advice ... now how would I go about "checking the input matches my expectations", those being that it should be a number, or else converted to zero (preferably without turning off warnings to do so). Ah yes, back to the original question then :-)
Either with Fletch's suggestion of looks_like_number from Scalar::Util, or a regex from Regexp::Common, or if actually, you're just expecting a positive integer, a simple regex like /^\d*$/