while (($state, $sub) = each %States) { $sub->( $page eq $state ); } #### sub show_secondstep { my $active = shift; if ($active) { -- print out form -- } else { -- print out hidden fields -- } } #### sub show_secondstep { my $active = shift; if ($active ==0) { -- print hidden -- } if ($active >=1) { if ($active == 2) { print "Please fill out all fields."} if (-- firststep fields OK --) { -- print this page -- } else { return show_firststep (2) } } }