my $validate = create_dptable Validate; my %params; # store params in a hash. Use symrefs to obtain original behaivor. # (i.e. $$_ = ...) foreach (params()) { $params{$_} = exists $validate->{"val_$_") ? $validate->{"val_$_"}->(param($_)) : $validate->{'error_page'}->($_) }