title: How can I get the HTTP status and Location header in Perl?
body: <p>I'm new to Perl but need to use it on a project I'm working on. What I need to do is check to see if a URL has a 301 redirect and if it has, get the location. The following told me the code but not the location:</p>
  
  <pre><code>use strict;
  use warnings;
  require LWP::UserAgent;
  
  my $ua = LWP::UserAgent-&gt;new;
  $ua-&gt;timeout(10);
  $ua-&gt;env_proxy;
  $ua-&gt;max_redirect(0);
  
  my $response = $ua-&gt;get('http://www.actwebdesigns.co.uk/');
  
  if ($response-&gt;is_success) {
      print $response-&gt;status_line;
      print $response-&gt;progress;
  }
  else {
      die $response-&gt;status_line;
  }
  </code></pre>
  
  <p>does anyone know how to get the location?</p>
  
  <p>Regards, </p>
  
  <p>Phil</p>