Search code examples
perlwww-mechanize

Getting input by name and not by index


HTML snippet:

  <input type='hidden' name='id' value='default' />

I'm using WWW::Mechanize to fill in a form, an input of which is above. I'm doing this:

$inputs[0]->value("nondefault");

since it's the first input in the form. But is there a way to refer to it as id?


Solution

  • According to the documentation,

    $form->param('id', 'nondefault');