use strict; use warnings; use LWP::UserAgent; use WWW::Mechanize; my $login_url = 'abc.xyz.com'; my $username = "abc"; my $password = "xyz123"; my $mech = WWW::Mechanize->new(); $mech -> cookie_jar(HTTP::Cookies->new()); $mech -> get($login_url); $mech->submit_form( with_fields => { "userid" => $username, "authmethod" => 'on', "username" => $username, "login-form-type" => 'pwd', "password" => $$password }, button => "btnSubmit", ); $mech->save_content('out1.txt');