Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: prepare insert statement outside while loop for speed

by McDarren (Abbot)
on Dec 02, 2010 at 05:19 UTC ( [id://874824] : note . print w/replies, xml ) Need Help??


in reply to prepare insert statement outside while loop for speed

$sth->execute($data[0],$data[1],$data[2], $data[3], $data[4],$data[5])
The above could be written a bit more succinctly as:
$sth->execute(@data[0 .. 5])
See Slices

Or, if you know that @data will always contain just six elements, then just simply:

$sth->execute(@data)
Hope this helps,
Darren