Depending in which environment you are working the list version of system might be more secure:
system( "/home/mail/addmembers", "-nemail.out", "-wy maillist");
prevents the shell to interpolate the arguments, and thus cuts down dramatically on the number of security problems that can arise if the arguments are obtained from untrusted users.
| [reply] [d/l] |
Yea, that looks just fine.
If you're looking to catch the output of it, consider using backticks.
You can also use fork(), open(), or exec() to run another process.
Take a look at chapter 14 in 'Learning Perl' ORA (the llama) if you can get your hands on it. | [reply] |
There was a similar post yesterday to which my reply is also relevant
to this question about testing for errors. See Re: running programs for details.
@a=split??,'just lose the ego and get involved!';
for(split??,'afqtw{|~'){print $a[ord($_)-97]} | [reply] |
Back ticks have definetely worked out best in the past for me. In your case you can just use:
my $output = `/home/mail/addmembers -nemail.out -wy maillist`;
And call it good, with the output to STDOUT being captured in the variable $output | [reply] [d/l] |