develooper Front page | perl.perl6.users | Postings from June 2018

Re: using run

Thread Previous
Simon Proctor
June 20, 2018 15:44
Re: using run
Message ID:
If you're wanting to run a command and have the output go directly to a
file you might want to look at shell?

You can still get back a Proc object and specify if you want access to the
input, output of error handles. So if you wanted to call an external
command, pass it some data but have it write out to a file you can do
something like this:

perl6 -e 'my $p = shell "cat > foo.txt",

The :in adverb says I want the in handle opened which I then write to and
close :)

Hope that helps.

On Wed, 20 Jun 2018 at 16:32 Theo van den Heuvel <>

> Hi all,
> trying to make sense of the documentation on run:
> In particular the last part. I don't  understand the adverbs :out and :
> err there.
> Can I set it up so that the output is piped into a file directly? If so
> how would I write that?
> I know I could use shell for that, but I doubt that is necessary.
> [On first reading I found the doc confusing because it start with a
> hairy example. WHy would anyone wish to write to a file named
> '>foo.txt'? How can that be the first example?]
> Thanks,
> --
> Theo van den Heuvel

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About