http://www.perlmonks.org?node_id=239765


in reply to sql query subroutine check

You can simplify parameter fetching substantially.

my ($cmd, @place_holders) = @_;

That doesn't explicitly stringify the place holders, but I'm not sure it's necessary in your code. You don't need the double quotes around variables-as-arguments in connect(), either, unless you're doing something really complicated. (My guess is that you're not.)

Be cautious with your return. In scalar context, since it's an array, you'll get the number of elements in the array. This may or may not be what you want.

Connecting and disconnecting on every pass through the sub can be expensive.

You may want to use Carp instead of die for error messages. It can be a bit friendlier.