Help for this page

Select Code to Download


  1. or download this
    my @choices = ("yes", "no", "y", "n");
    
    ...
    my $otherChoice = query("Can you use an invalid default to force them 
    +to type in their choice?", "yes/no", "yes", "y");
    
    my $finalChoice = query("Oh, just enter whatever you want.");
    
  2. or download this
    # &query(Prompt String, optional default, optional list of restrictive
    + choices)
    #  If the choices are provided at the end, only one of those can be ch
    +osen.
    ...
        
        return $answer;
    }