Okay, just wanted to thank everybody for their help. This is truely the great thing about the Perl community. Below is my final code, which now works as I had hoped. I changed the data structure to be hash of hash as suggested. It's a lot clearer.
%sample =
{
'short' =>{name=>"Job ID",
width=>40,
cgi=>{method=>'textfield',field=>'short',size=>15,max=>10},
div=>"center"},
'name' =>{name=>"Job Name",
width=>150,
cgi=>{method=>'textfield',field=>'name',size=>35}}
};
foreach (keys %sample)
{
$method = $sample{$_}{'cgi'}{'method'};
# if method doesn't exist, you get undef sub error in CGI pm
if ($method)
{
print $q->$method(-name=>$job{$_}{'cgi'}{'field'},
-default=>$job{$_}{'cgi'}{'default'},
-size=>$job{$_}{'cgi'}{'size'},
-maxlength=>$job{$_}{'cgi'}{'max'}
);
}
print "\n";
}
--
Filmo the Klown