Something like:
sub insertRow($$;$$$$) { my $table = shift; my $placeholders = join(',', map { "?"; } @_); $dbh->do("INSERT INTO $table VALUES ($placeholders)", undef, @_); } Edited: you need to add undef as a parameter. Leon Timmermans suggests not using prototypes