in reply to Running blocks of shell script from within perl script
Yes, indeed. exec, by any other name, can only “execute” one ... “something.” Therefore, if you want that “one something” to consist of “executing many commands,” you need to persuade “the host, whoever it is ...” to execute “many commands” as “one something.” :-D In other words, you need to build some kind of a shell-script. Construct such a script (if necessary). Then, make it “executable.” Then, execute “it,” and gather-up its [combined ...] output. Q.E.D.
“Perl or not ...” and, pretty much, regardless of operating system, this will be the way that you can get this kind of requirement done.