sub loginyahoomail() { my ( $user, $password ) = @_; my $mech = WWW::Mechanize->new(); $mech->get( "https://mail.yahoo.com" ); my $c = $mech->content; if ( $c =~ m/login_form/ ) { print "Login form coming===\n"; $mech->form_name( 'login_form' ); $mech->set_fields('$user','$password'); $mech->submit(); } $c = $mech->content; print "$c"; }