in reply to subroutine recurse vs goto LABEL

In the recursive example, if a malicious user provides sufficient amounts of bad input, Perl may kill your program with a "deep recursion" message. (The number 4000 comes to mind as the recursion limit, but I'd have to check.)

In the goto example, you've basically written a while loop, which is how most people would do it.

I'd remove the duplicate code from the end of each if/else statement, and write it as such:

#!/usr/bin/perl -w use strict; # &subname can have unpleasant side effects a(); sub a { my $a; while (lc($a) ne 'q') { chomp($a = <STDIN>); last unless $a; if ($a =~ /\D/) { print "Not an integer!\n"; } else { print "You typed: ->$a<-\n"; } } }
There's more than one way to do it.