use warnings; use strict; my $sql = <## select A format \"%s|\", B format \"%s|\", C format \"%s|\", (select D format \"%s|\", E format \"%s|\", F format \"%s|\", (select G format \"%s|\", H format \"%s|\" from AA where ID = Z) from BB where ID2 = X), I format \"%s|\", J format \"%s|\" from CC;