in reply to Printing SQL query in Perl

you can take the query in a variable and try printing the variable and use the same variable for executing.