in reply to Security and Style for CSV to mySQL script
I'd prefer to set @question_marks like this:
which populates the whole thing at once and eliminates an auxiliary variable.my @question_marks = ('?') x @columns;
You should localize $", moving it inside braces close to where it's needed.
That will prevent surprises in case arrays are stringified elsewhere.else { local $" = ', '; $sth = $dbh->prepare( "INSERT INTO $table (@columns) VALUES (@questio +n_marks)" ); $sth->execute(@csv_values); }
After Compline,
Zaxo
|
|---|