my @hdr = qw/title instructor inst_email active max_students description syllabus begin_date syll_name begin_time class_length/; my @val = map "?", @hdr; my @real_val = map{param($_)}@hdr; my $sql; { local $" = ','; $sql = "insert into class_info(@hdr) values (@val)"; } my $sth = $dbh->prepare($sql); $sth->execute(@real_val);