rashichauhan has asked for the wisdom of the Perl Monks concerning the following question:

Source code of my perl programme is this : <option style="color:black;" value=884 >Bacillus anthracis (Strain: Ames Ancestor) MicroCyc</option>
my $species = "Bacillus anthracis(Strain:Ames Ancestor)MicroCyc"; $mech->field( 'species', $species);
In the page source code value =884 is given,but in display Bacillus anthracis(Strain:Ames Ancestor)MicroCyc is coming so I have to write 884 or Bacillus anthracis(Strain:Ames Ancestor)MicroCyc in my perl programme? When I am writing Bacillus anthracis(Strain:Ames Ancestor)MicroCyc error is coming can't call method on an undefined value.

Replies are listed 'Best First'.
Re: problem regarding the value given in the select box
by Corion (Patriarch) on Sep 14, 2013 at 08:06 UTC

    Have you reviewed the documentation of WWW::Mechanize for ->field?

    Given the name of a field, set its value to the value specified.

    This sets the value, not the label or anything that is presented to the user.

    If you are automating a website, you will need to learn a bit about HTML and HTTP too.

      Thanx!! I have tried the value.For example in the HTML page source <html> <option style="color:black;" value=884 >Bacillus anthracis (Strain: Ames Ancestor) MicroCyc</option>
      Now I am inputing value 884.but the error is coming "can't call method on undefined value".Plz help me!!

        You don't show the relevant code, and you don't tell us where the error happens.

        Please show the relevant code and the exact error message to help us help you better.

        A reply falls below the community's threshold of quality. You may see it by logging in.