Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
VS#!/usr/bin/perl -w use strict; &a; sub a{ print "enter a number: "; chomp(my $a=<STDIN>); if ($a=~/[^\d]+/){ print "not a number!"; &a; } else { print "You typed: $a\n"; &a; } }
#!/usr/bin/perl -w use strict; &a; sub a{ ASK: print "enter a number: "; chomp(my $a=<STDIN>); if ($a=~/[^\d]/){ print "not a number!\n"; goto ASK; } else { print "you entered: $a\n"; goto ASK; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: subroutine recurse vs goto LABEL
by chromatic (Archbishop) on Sep 14, 2001 at 22:42 UTC | |
|
Re (tilly) 1: subroutine recurse vs goto LABEL
by tilly (Archbishop) on Sep 14, 2001 at 23:06 UTC | |
by John M. Dlugosz (Monsignor) on Sep 15, 2001 at 02:44 UTC | |
|
Re: subroutine recurse vs goto LABEL
by patgas (Friar) on Sep 14, 2001 at 22:39 UTC | |
|
Re: subroutine recurse vs goto LABEL
by derby (Abbot) on Sep 15, 2001 at 00:22 UTC | |
|
Re: subroutine recurse vs goto LABEL
by herveus (Prior) on Sep 14, 2001 at 23:57 UTC |