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

perlcgi has asked for the wisdom of the Perl Monks concerning the following question:

What's the neatest/coolest way to quote the elements of @line below. AFAIK dbh->quote() only quotes a scalar.
Much obliged for any pointers.
my $sql_fmt = "INSERT INTO whatever VALUES( %s, %s, %s, %s, %s, %s, %s +, %s, %s, %s, %s, %s, %s, %s)"; while (<INFILE>) { my @line = (parse_csv ($_)); my $sql = sprintf ($sql_fmt, @line); #Elements of @line need to b +e in quotes $dbh->do($sql); }