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; } }
In reply to subroutine recurse vs goto LABEL by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |