my $submit = 0; # oder anderer default-wert for my $i (1 .. $max) { if ($cgi->param("button$i")) { $submit = $i; last; } }