If I use a pipe then I get the prompt as well as the result as part of the return value. Using a here document doesn't return the prompt. | [reply] |
What qx is doing is calling the shell perl -V:sh, and shell usually doesn't like newlines (which is apparently why in bash you use heredoc), so you have to quote/escape/encode/serialize those args, for which you can use String::ShellQuote ( or Win32::ShellQuote )
Or use IPC::Run3, its not backticks but it handles quoting for you
Or use IPC::System::Simple capturex, its close to backticks, and it can handles quoting for you
| [reply] |
You could, of course, accept "the prompt as well as the result as part of the return value" and then remove the prompt -- with the likes of =~ s///;, among other possibilities.
| [reply] [d/l] |