Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by jkahn (Friar)
on Sep 11, 2002 at 20:26 UTC ( [id://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).

Replies are listed 'Best First'.
•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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://197067]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2024-03-28 08:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found