in reply to Escaping and quoting ?????

Your statement
@Output = qx { /nz/kit/bin/nzsql -d histdb -c "$SQL1" };
causes the shell to re-interpolate the contents of $SQL, because you use double quotes.

You could either pass single quotes to the shell, or add another "\\" before each dollar sign in the contents of $SQL. I'd suggest:

@Output = qx { /nz/kit/bin/nzsql -d histdb -c '$SQL1' };

        What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
              -Larry Wall, 1992

Replies are listed 'Best First'.
Re^2: Escaping and quoting ?????
by pgduke65 (Acolyte) on Jul 03, 2014 at 16:29 UTC

    Thanks for the clarification on the problem. I had forgotten to change the quotes from doubles to singles for the -c argument. It worked like a charm. Thank you all for the help. Perl Monks are awesome!