[oak perl] new to Perl

Quinn Weaver qw at sf.pm.org
Mon Dec 4 12:08:06 PST 2006


On Mon, Dec 04, 2006 at 08:40:15AM -0800, Tabatchnick, Justin wrote:
> Hi ;
> 
>  
> 
> I am new to Perl and I need some advice on how to execute a command
> within a Perl script. In particular I need to run HSPICE  ( an
> electrical simulator) followed by two arguments -i and the filename. Is
> this possible within Perl or do I have to create a Unix shell script ? 

Yep, you can do it.  'man perlfunc' and check out system, fork, and exec.
If you want your Perl process to wait until HSPICE exits and then resume
doing Perl stuff, use system.  If you want to end the Perl program,
replacing it with the HSPICE process, use exec.  If you want to run
HSPICE in the background while Perl continues to do other things,
use fork and then exec.

By the way, I recommend O'Reilly's Perl Cookbook for people new to
Perl.  It covers many issues like this, where you know what you want
to do but don't know how to do it.  It's a huge time-saver.

--
qw (Quinn Weaver); #President, San Francisco Perl Mongers
=for information, visit http://sf.pm.org/weblog =cut


More information about the Oakland mailing list