Web Mechanization in Perl using WWW::Mechanize

WWW::Mechanize, or Mech for short, helps you automate interaction with a website. It supports performing a sequence of page fetches including following links and submitting forms. Each fetched page is parsed and its links and forms are extracted. A link or a form can be selected, form fields can be filled and the next page can be fetched. Mech also stores a history of the URLs you've visited, which can be queried and revisited.
To install WWW::Mechanize you have to open CPAN console ("cpan command from console?") and write 'install WWW::Mechanize'.

Example: this script go to http://www.google.com and make a search.

use WWW::Mechanize;
my $mech = WWW::Mechanize->new();
$url = "http://www.google.com";

$mech->get( $url );

$mech->submit_form(
  form_number => 0,
  fields => {
    q => 'gentoo',
  }
);

print $mech->content();

This is a simple script; it write the result to console.