in reply to regular expression trouble

In addition to this, for the case when the key starts with "-" ( if (/^-/) ),
You are not appending to $names.

The "for" loop and "chop"s could be replaced by:

my $names = join ",\n", map {s/^-//; $_ } keys %data; my $values= join ",\n", map { m/$-/ ? $data{$_} : $dbh->quote($data{$_ +} } keys %data;
(I have made some assumptions on what you want done when the key starts with "-".)

             "I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
        -- Dr. Cox, Scrubs