#
# A module to ask question
#
# Usage: $ANSWER = question( "Question sentence", "yes", "no", "well", .... );
# User can answer only with given words given from second arguments.

sub question
{
    my( $qsent, @possibility ) = @_;
    printf( "%s : ", $qsent );
    $match = 0;
    while( $match == 0 ) {
	$ANSWER = `head -1`;
	chop( $ANSWER );
	foreach( @possibility ) {
	    if( $ANSWER eq $_ ) {
		$match = 1;
	    }
	}
	if( $match == 0 ) {
	    printf("Again : ");
	}
    }
    return $ANSWER; 
}

1;
