in reply to Re: Re: Problem with code
in thread Problem with code
('?') x @fields
will produce a list which has exactly as many elements as @fields, where each element is a question mark. So given @fields = qw(foo bar baz) I have created a list like ('?', '?', '?')
Then I join them using a comma as a separator, giving me, in the previous example, '?,?,?'.
As explained in detail in the DBI documentation section on placeholders, I do that so I don't have to generate a new SQL statement over and over; instead, I generate a single one, where I let the driver fill in the values I supply to execute().
Makeshifts last the longest.
|
|---|