in reply to Effective way in perl
I guess $grep expands to the grep of your choice, and since you are redirecting the stdout, your expression is supposed to return only the stderr of the programs. Is this correct?
I don't find your code so bad (since I, personally, wouldn't care about all the grep processes you are spawning). If you wouldn't insist on separating $swlist's stdout and stderr, you could open(SWLIST,'/your/swlist|') and grep inside your Perl program. If you need to keep stdout and stderr apart, have a look at IPC::Run.
|
|---|