my $url = URI->new('http://www.safe.nite.go.jp/data/hazkizon/' . 'pk_e_kizon_input_second.home_object'); for my $cas ( '50-00-0', '50-50-1' ) { $mech->get($url); if ( $mech->success() ) { $mech->form_number(1); $mech->select( sel_item1 => 'cas_no' ); $mech->set_visible( [ text => $cas ] ); $mech->select( search_meth1 => 'full' ); $mech->submit(); } }