Mike, If you have a complete example of what you are starting with and what you want to end up with your question would be clearer. If I understand you correctly: You start with raw SQL such as you might enter into a Postgres command line tool (for example psql). What you want is the equivalent Perl source code to define the identical SQL as a string literal.
Please look at the docs here: https://metacpan.org/pod/perlop https://metacpan.org/pod/perlop#Quote-and-Quote-like-Operators https://metacpan.org/pod/perlop#Gory-details-of-parsing-quoted-constructs https://metacpan.org/pod/perlop#Additive-Operators (Especially the “.” Operator) https://metacpan.org/pod/perlop#Assignment-Operators (Especially the “.=” Assignment Operator) https://metacpan.org/pod/perlfunc#ord-EXPR https://metacpan.org/pod/perlfunc#chr-NUMBER And see if that helps. The information contained in this electronic mail transmission is intended only for the use of the individual or entity named in this transmission. If you are not the intended recipient of this transmission, you are hereby notified that any disclosure, copying or distribution of the contents of this transmission is strictly prohibited and that you should delete the contents of this transmission from your system immediately. Any comments or statements contained in this transmission do not necessarily reflect the views or position of Radial or its subsidiaries and/or affiliates.