in reply to Disable output from system

You can dup stdout and stderr, then close them:
sub stfu_system { local (*OUT, *ERR); open OUT, ">&STDOUT"; open ERR, ">&STDERR"; close STDOUT; close STDERR; system @_; open STDOUT, ">&OUT"; open STDERR, ">&ERR"; }

Replies are listed 'Best First'.
Re^2: Disable output from system
by ig (Vicar) on Mar 28, 2009 at 21:15 UTC

    This will work for many commands but some will fail if they don't have STDOUT and/or STDERR open.

      True. For those (poorly-written) commands, s!close\s+(\w+)!open $1, '>/dev/null'!