http://qs321.pair.com?node_id=85709


in reply to A more elegant solution?

Here's my attempt at a more elegant way of generating an SQL INSERT statement:

sub insert_into { my $table = shift; my $row = shift; return sprintf( 'INSERT INTO %s (%s) VALUES (%s)', $table, join(', ', keys %$row), join(', ', ('?') x keys %$row), ); }