Get system command output
If you don't want to execute it in shell (and you probably don't), then use this:
say run($command, $arg1, $arg2, :out).out.slurp-rest;
Unfortunately, it is very long to type, but that is the only way to pass your variables as arguments safely.
You might be tempted to start using shell when you have to pipe something, but even in that case there is no need to do so. See this code:
my $p1 = run 'echo', 'Hello, world', :out;
my $p2 = run 'cat', '-n', :in($p1.out), :out;
say $p2.out.slurp-rest;
See docs for more info.
If you really want to run something in shell and you understand potential security problems, then you can use qx//
(interpolates environment variables) or qqx//
(interpolates normally). See the docs for more info.
say qx[dir]
Output:
Find_URI_in_text.p6 History_variables.p6 K-d_tree.pl
Fractran.pl History_variables.pl XML_Input.p6