Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: loop inside system command

by abaxaba (Hermit)
on Jul 17, 2002 at 14:18 UTC ( [id://182433]=note: print w/replies, xml ) Need Help??


in reply to loop inside system command

If I understand your question correctly, you'll need to execute system singularly, and build your loop around it, as opposed to in it
foreach ($firstbuild, @otherbuilds) { system (qq(C:/execu $_ file.c)); }
One thing you may consider, esp. if @otherbuilds can grow to be sufficiently large: system is a double fork, in terms of processes spawned. One proc. for the system call, one for the actual command to run. If you're going to be calling system on more than a couple of items, you may consider doing something like so:
open (OUT, ">cmd.txt") || die "$!\n"; foreach ($firstbuild, @otherbuilds) { print OUT "C:/execu $_ file.c\n"; } close OUT; system ("cmd.txt");
The reason? Instead of spawning 2N processes, you'll spawn only N+1. 3 or 4 system calls probably doesn't warrant the extra work. If you got 100 or so...well, you get the picture.

ÅßÅ×ÅßÅ
"It is a very mixed blessing to be brought back from the dead." -- Kurt Vonnegut

Replies are listed 'Best First'.
Re: Re: loop inside system command
by DS (Acolyte) on Jul 17, 2002 at 14:24 UTC
    thanks to you all :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://182433]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-19 14:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found