Well, given a list on the left hand side,
x will produce an output list which consists of as many copies as you specify with the right hand side operand. The right side is evaluated in scalar context, and we're using an array there; the result is the number of elements in that array. So
('?') 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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.