Navigating a WebPage with Perl

Hi All
Below is Code, It opens a link from which it ask a login name and password, the script enter the login name and password and navigate to next page..
In the next page there is a drop down box from which i have to select a value, I have written the code but it gives error

#!/usr/bin/perl
use LWP::UserAgent;
use  WWW::Mechanize;
use HTTP::Cookies;
use strict;

my $username="123456";
my $password="XXXXX";
my $project="Systems";
my $agent = WWW::Mechanize->new();
$agent->get('http://www.XXXXX.com');
$agent->form_name("login_form");
$agent->field("txtLoginId", $username);
$agent->field("txtPassword", $password);
$agent->submit();
#Till now it has success full logined, From here it has to select one value from a drop #down box
$agent->form_name("frmProject");
$agent->field("cboProject", $project);
my $response=$agent->submit();

  if ($response->is_success){
  print "\nContent:\n";
  print $response->as_string;
  }elsif ($response->is_error){
  print $response->error_as_HTML;
  } 
 

From here I have selected a value from a drop down box but when the script presses the submit It gives the error

Error POSTing http://XXXX/Web/SetProjSession.as
p: Internal Server Error at C:\Users\parth_mittal\Documents\Perl Prgms\5.pl line

Any idea please

Any invalid characters on the pull down choices that need to be scaped?

I didn't get you, can you please explain me with an small example.

Suppose i have logined into the first gmail page, where it ask's for user name and password, after that suppose i want to click on Compose button then how can i do in Perl Script..

---------- Post updated at 07:48 AM ---------- Previous update was at 07:47 AM ----------

I have searching it for a very long time, but didn't find the way,,