use strict; use WWW::Mechanize; my $url = "http://www.ai.mit.edu/projects/infolab/"; my $question = 'What is AI'; my $robot = new WWW::Mechanize; $robot->get($url); $robot->form_number('1'); $robot->set_fields('query' => $question); # ask a question $robot->click(); # Get the reply to my question my $html = $robot->content(); # Extract the answer my ($text) = $html =~ /(