in reply to Can't I chop the lvalue of join?
However that's too many parens and single quotes to grok for my taste. Here's what I'd do:print 'INSERT INTO table(' . join(',', @fields) . ') VALUES (' . join(',', ('?') x @fields) . ')';
Update: or of course, even better{ local $" = ','; print "INSERT INTO table(@fields) VALUES (@{[ map '?', @fields]})" +; }
Update 2002 09 30: it has to be $" of course, not $, -- doh.{ local $" = ','; print "INSERT INTO table(@fields) VALUES (@{[('?') x @fields]})"; }
Makeshifts last the longest.
|
|---|