Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re: Re: Running System Commans With ""

by jkahn (Friar)
on Sep 11, 2002 at 20:26 UTC ( #197067=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Running System Commans With ""
in thread Running System Commands With ""

Yes, it's faster because there's no need for an intermediate sh process to get loaded, parse the arguments, redirect input and output where they should be sent to, and pass the arguments to the program invoked.

If you do want shell-style redirection, though, you'll have to use a system EXPR syntax. It's not all bad; a number of Perl Cookbook recipes use it for good reason (mostly for shell redirection).


Comment on Re: Re: Re: Running System Commans With ""
Select or Download Code
•Re: Re: Re: Re: Running System Commans With ""
by merlyn (Sage) on Sep 12, 2002 at 17:04 UTC
    Yes, it's faster because there's no need for an intermediate sh process to get loaded, parse the arguments, redirect input and output where they should be sent to, and pass the arguments to the program invoked.
    No, if there are no shell metachars, Perl does the splitting itself, so there's no sh process involved.

    Convince yourself of this by executing an appropriate ps command during each of

    system "sleep 5"; system "sleep 5;"; # notice the semicolon
    Other arguments in favor of "avoid the sh at all costs" in this thread are still valid. Just wanted to point out that the single-arg system does not always call sh. It just might.

    -- Randal L. Schwartz, Perl hacker

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://197067]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2014-08-30 20:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls