On Tue, 19 Jul 2011 21:14:10 +0200, Tessio Fechine <oiss...@gmail.com> wrote:

Hello,
I have a subroutine that uses useradd to create accounts

--
@cmd = ('useradd', '-m', $account);
my $result = system @cmd;
--

but when useradd fails, I need to stop it from sending the error message to
STDER.
Is it possible with system?

Thanks!


For an easy and cross-platform solution you can use Capture::Tiny to capture 
both STDERR and STDOUT separately and then have your perl code decide what to 
do with each.

--
With regards,
Christian Walde

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to