in reply to WWW::Mechanize with optional fields

Use a hash to store the data. Hashes are ideal if you have name - value pairs:
my %fields = ( name => "Richard", age => "12", location => "mars", forum_user => "xxxxx", forum_pass => "yyyyy", );
you can pass that on to submit_form easily:
$mech->submit_form( form_name => $search_form, fields => \%fields, # pass reference to %fields );
See also perldata and perlref