#!/afs/athena/contrib/perl/p

$word = '(\b\w+\b)';

%REPLY = ("what is $word?", 'wiw',
	  "how are you?", 'hoy');
@token = keys %REPLY;

@hoy = ('Fine, and you?', 'Miserable');
@wiw = ("I don't know what __1__ is.  Sorry.");
while(1){

    $input = &input();
    &tokenize($input);


}


sub input {
        local($foo);
        print("--->");
        $foo = <STDIN>;
        chop($foo);
	$foo =~ y/[A-Z]/[a-z]/;
        $foo;
}

sub tokenize {
    local($string) = @_;

    @wst = split(/[ \t]+/, $string);
    for (@token){
	if($string=~/$_/){
	    $one = $1;
	    print("Mathces token: $_\n");
	    eval("\@rep = \@$REPLY{$_}");
	    $repl = $rep[rand($#rep+1)];
	    $repl =~ s/__1__/$one/;
	    print("Reply: $repl\n");
	}
    }
}






