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

Re: using run

Thread Previous | Thread Next
Todd Chester
June 21, 2018 04:55
Re: using run
Message ID:

On 06/20/2018 08:15 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?]
> Thanks,

Hi Theo,

There is a misunderstanding about "run".  This is running a command
with out a shell (sh, bash, csch. etc.).  Pipes "|", redirects
"2>&a" are all shell functions.  So, "run" can not do any of them.

But who cares!  With "run" you just suck up all the data into
a string, then you can do exactly what you want with it,
not be relying on some helper program in the shell.  Perl
is 1000 times more powerful than shell commands.

My favorite command is to suck up some data into a string, then
do a "for" on a "split" of the string and look for what I want
with match "m//" and "words" (a great grep substitute).

Once you have manipulated the data yourself in Perl a few times,
you will forget all about shell helper commands!  Way too awkward.


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