my $ans = 1; # or whatever. while ($ans) { %pickme = ( n => 1 ); #yes, this should be outside the while. So sue me ;-) $ans = $mech->select( 'server', \%pickme ); if ($ans) { $inputobj = $mech->current_form()->find_input( 'remove', 'submit'); die 'argh! Cannot find delete button on the iSCSI Access page!' unless $inputobj; $ans = $mech->click_button( input => $inputobj ); } } print "Done! Now, accept the empty list\n"; # ok, now accept a (hopefully) empty list of allowed accessors $inputobj = $mech->current_form()->find_input( 'accept', 'submit'); die 'argh! Cannot find Accept button on the iSCSI Access page!' unless $inputobj; $ans = $mech->click_button( input => $inputobj );