use LWP::UserAgent qw( ); my $response = LWP::UserAgent->new()->get('http://www.w3.org/html'); for (;;) { my $uri = $response->request()->uri(); my $status = $response->status_line(); print("$uri => $status\n"); $response = $response->previous(); last if !defined($response); print("as a result of\n"); } #### http://www.w3.org/html/ => 200 OK as a result of http://www.w3.org/html => 301 Moved Permanently