Hi,
I've a Perl subroutine which asks input from User. I perform a check inside that subroutine itself whether the input entered is a valid input.
If it's not, I want to call the subroutine again to let the user enter a valid input this time.
My subroutine is as follows:
sub some_routine {    
    print "Enter a number to select   (1) Apple (2) Mango (3) grapes:"
    $value=STDIN;
    if($value =~ /[^1-3]/ ) {
        print "The input is not valid!";
        print "Do you want to continue selecting a fruit again (Y or N)?";
        $choice = STDIN;
        if( $choice eq "y") {
            ### I want to call the subroutine again to enter input ###
          } else {
            exit;
        }
    }
}
So how to recurse a subroutine in this?