in reply to Re^2: I think I just found a good reason to use backticks in a void context.
in thread I thought I found a good reason to use backticks in a void context, but I was wrong.

Right... one that's more fair would be to fork yourself and close STDOUT and STDERR, which would probably be even faster. Something like:
defined(my $kidpid = fork) or die "cannot fork: $!"; unless ($kidpid) { close STDOUT; close STDERR; exec "your", "multiarg", "command", "here"; die "$!"; } waitpid($kidpid, 0);

That'd be the equivalent to your backtick-that-just-happens-to-not-invoke-the-shell, but probably even more efficient.

  • Comment on Re^3: I think I just found a good reason to use backticks in a void context.
  • Download Code