examples/www/web_calc.pl
#!/usr/bin/perl
use strict;
use warnings;

use WWW::Mechanize;

my $url = 'http://localhost:8080';

my $mech = WWW::Mechanize->new;
$mech->get($url);

$mech->follow_link( text => 'calculator' );

$mech->submit_form(
    fields => {
       a => 23,
       b => 19,
    },
);
print $mech->content;


Output:

examples/www/web_calc.pl.out
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
  Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Result</title></head>
<body>
<h1 align="center">42</h1>
</body>
</html>