Perl's goto LABEL is an awesome tool when one wants loop-like flow control outside of loops.
But unnecessary in many cases:
my $input;
INPUT: {
print 'number> ';
chomp($input = <STDIN>);
redo INPUT unless $input && $input=~/\A[0-9]+\z/;
}
print $input, "\n";
(Or just use a proper prompting module, such as IO::Prompter.)
TIMTOWTDI - I'm not saying that goto isn't sometimes an acceptable solution. But IMHO those cases are much more rare than an actual need for goto, especially in a language like Perl that has many other nice options for flow control. And of course if you want to use goto, all Perl::Critic policies are optional; this one just happens to be what the OP wanted. I'm not going to start a debate about whether goto is good or not. Note my wording: "A goto LABEL is considered a bad practice by a number of people, as it can lead to hard-to-understand and brittle spaghetti code." There was a good line by a comedian, paraphrasing: "I love the phrase 'a number of' because it can mean anything. 'A number of supermodels want to sleep with me.' That number is zero."
Update: Fixed the regex.