in reply to loop inside system command
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:foreach ($firstbuild, @otherbuilds) { system (qq(C:/execu $_ file.c)); }
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.open (OUT, ">cmd.txt") || die "$!\n"; foreach ($firstbuild, @otherbuilds) { print OUT "C:/execu $_ file.c\n"; } close OUT; system ("cmd.txt");
| ÅßÅ×ÅßÅ
"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 |