Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: I think I just found a good reason to use backticks in a void context.

by merlyn (Sage)
on Jan 13, 2007 at 21:50 UTC ( [id://594595]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://594595]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.