[Techtalk] using shell commands in perl scripts

Rasjid Wilcox rasjidw at openminddev.net
Sun May 25 22:11:24 EST 2003

On Sunday 25 May 2003 20:15, Berenice wrote:
> 1. Using the system function runs /bin/ls as a child process. What's
> the purpose/advantage of using a child process?

I'm really not sure what you are asking here.  In all three cases /bin/ls is 
run as a child process.  It has to be a seperate process, and since it is 
invoked by the perl script, it is its child.  I assume there is a way to 
start a process so that it is not a child process, but I've never looked into 

> 2. I'm new to the idea of using pipe with open and filehandles, like
> this:  open (LSPIPE, "/bin/ls |");  Is the purpose of the pipe to
> direct output of /bin/ls to the LSPIPE filehandle?

Yep.  That is it.

> 3.  I looked at man perlsec about taint testing, in regards to
> #!/usr/bin/perl -Tw.  It sounds like a good idea, but why do I get
> this message when I run the script with the -T option:
> > Too late for "-T" option at bash_in_perl line 1.

How are you running it?  I have not been able to find a way to recreate that 
error, so I can't suggest a solution.

Lastly, I meant to include 'use strict;' at the start of the script, but 
forgot.  This, in addition to the -Tw options, are standard in almost every 
serious perl program I've looked at.




Rasjid Wilcox
Canberra, Australia  UTC + 10

More information about the Techtalk mailing list