my $response = $mech->get($url); if($response->is_success()) { # do your stuff } else { # grab the status? warn "Unable to connect: " . $response->status_line(); }