title: Open URL in Linux using Perl (or any language)?
body: <p>I am new to Perl scripting. I wanted to parse a text file, encode the parsed text and attach in URL. Please point me to right resources if you know any.  This is my major problem. </p>
  
  <p>Now I try to get a URL running and save it in a text file using LWP module in Perl. I used the following program to connect to Google but I am getting "401 UNAUTHORIZED" error. Please help - where I should provide my user authentication details and password? </p>
  
  <pre><code>#!/usr/bin/perl
      use strict;
      use warnings;
      use LWP::UserAgent;
      use HTTP::Request::Common qw(GET);
      use HTTP::Cookies;
  
      my $ua = LWP::UserAgent-&gt;new;
  
      # Define user agent type
      $ua-&gt;agent('Mozilla/8.0');
  
      # Cookies
      $ua-&gt;cookie_jar(
          HTTP::Cookies-&gt;new(
              file =&gt; 'mycookies.txt',
              autosave =&gt; 1
          )
      );
  
      # Request object
      my $req = GET 'http://www.google.com';
  
      # Make the request
      my $res = $ua-&gt;request($req);
  
      # Check the response
      if ($res-&gt;is_success) {
          print $res-&gt;content;
      } else {
          print $res-&gt;status_line . "\n";
      }
  
      exit 0;
  </code></pre>