I found it. man perlop for backticks:
"In scalar context, a single string consisting of all output is returned. In list context, a list of values is returned, one per line of output."
Solution:
print escapeHTML(scalar(`echo abc; echo def; echo ghi`));