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 =~ /(

START(?:.|\n)*
)/mg; # Reformat the text $text =~ s/<[^>]*>//g; # Strip HTML tags $text =~ s/(?