$_[0] =~ /^\s*\+\-?\d+\s*$/ #### if (is_integer_string($input){ do_integer_function($input); } else{ die "You must supply an integer\n"; }