in reply to Can't I chop the lvalue of join?
In the values section of the SQL statement, I need a string of the form "?,?,?" where there is a ? for each field, and all the ?s are delimited by commas.Just do
orjoin ',', map "?", keys %$c
(preferably the latter.)join ',', ("?") x keys %$c
And no, you can't chop the result of join directly, though your code (at least, the first two lines) works fine, as does this slightly more compacted version:
Your immediate problem must lie elsewhere.chop(my $placeholderstr = join '', map {'?,'} keys %$c);
p.s. A combination of your and my ideas resulted in
and it works just fine.chop(my $placeholderstr = '?,' x keys %$c);
|
|---|