You can build the insert string with the NAME attribute of the statement handle.
From the docs:
`NAME' (array-ref, read-only)
Returns a reference to an array of field names for each
column. The names may contain spaces but should not be
truncated or have any trailing space. Note that the
names have the letter case (upper, lower or mixed) as
returned by the driver being used. Portable applications
should use the NAME_lc entry elsewhere in this document
or the NAME_uc entry elsewhere in this document.
print "First column name: $sth->{NAME}->[0]\n";
|