in reply to catching incorrect input type

You can use regexes to validate user input:

if ($input =~ /^[0-9]+$/) { # work with $input here } else { die "Please enter an integer\n"; }

See also: Scalar::Util::looks_like_number