Could you show a Short, Self-Contained, Correct Example, that is, a short piece of example code that shows the problem, with short sample input and the expected output you want to get, and the actual output, including any error messages, each inside <code> tags?
Going off of your description, I would recommend a module like IPC::System::Simple, its systemx and capturex functions avoid the shell*, and as LanX said, you can provide the commands to be executed in Perl constructs like q{}. Note how in the following, I don't have to escape quotes or $ (it's printing the $$ variable).
use warnings; use strict; use IPC::System::Simple qw/systemx capturex/; systemx('perl', '-e', q{print "'$$'\n"} ); my $o = capturex('perl', '-e', q{print "'$$'"} ); print "<$o>\n";
I wrote at length about the issues with running external commands here.
* Update: Note this also means there won't be any shell redirections or piping available. If you need this, please show and example of the commands you're trying to run, often there is a way to work around it e.g. with capturex, temporary files, or a different module like IPC::Run3 or IPC::Run.
In reply to Re: awk cmd in perl
by haukex
in thread awk cmd in perl
by blur
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |