# UNTESTED; USE AT YOUR OWN PERIL :-) my $response = $mech->submit_form( form_name => 'loginForm', # ... ); # Follow HTTP or META refreshes. if (my $url = $response->header('Refresh')) { $url =~ s/^\d+;url=//i; $mech->get($url); }