my $response = $ua->post('URL', Content => ... credentials ...); my $token = $response->headers->{'Set-Cookie'}; # if there is only one cookie line my $token = $cookies->get_cookies( 'URL', 'AUTH_TOKEN' ); ...