in reply to Avoid embedding variables in SQL - Dancer App

Your first example only uses one variable in the place.

Your second example uses three placeholders, but you don't want categories.id_cat to be compared as a string.

Placeholders only work for constant values, not for column references. You will need to use string interpolation for that.