use strict; # <- always start with this use warnings; # <- this is good too use WWW::Mechanize; my $mech = WWW::Mechanize->new(); $mech->credentials( 'admin', 'password' ); $mech->get( 'http://192.168.1.1/' ); $mech->follow_link( test_regex => qr/configuration/ ); $mech->submit_form( form_number => 1, fields => { ip_address => '202.36.7.8', }, );