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

Re: using run

Thread Previous | Thread Next
Brad Gilbert
June 21, 2018 17:47
Re: using run
Message ID:
:out can take an argument

On Wed, Jun 20, 2018 at 10:32 AM Theo van den Heuvel
<> wrote:
> 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?]

    my $fh = open 'foo.txt', :w;
    run 'echo', 'foo bar baz', :out($fh);
    close $fh;

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