my $f = 0; for my $form ($mech->forms) { printf "Find form #%d: %s\n", ++$f, $form->attr('name'); my $i = 0; for my $input ($form->inputs) { printf "Input #%d: %s (type: %s), values: [%s]\n", ++$i, $input->name, $input->type, join(', ', $input->possible_values); } }