Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: how to invoke unix commands in perl

by arhuman (Vicar)
on Feb 08, 2001 at 20:04 UTC ( #57195=note: print w/replies, xml ) Need Help??


in reply to how to invoke unix commands in perl


use backquote :
$result=`wc -l /etc/passwd`;
or use system or exec

Replies are listed 'Best First'.
Re: Answer: how to invoke unix commands in perl
by arhuman (Vicar) on Feb 08, 2001 at 20:10 UTC
    OOPS ! I can't modify it...

    Please use your usual doc (Site Library, Camel book, perldoc) to understand the implication in term of process forking, shell spawning, security...
    But most of all don't forget that spawning a shell is cpu/memory consumming and can often be avoided by few perl internal function...
    (Especially in this case of a wc -l)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://57195]
help
Chatterbox?
[Corion]: Oh - jwz gives us interesting insight in cloud hosting. I'm amazed how many people suggest he rework his setup into AWS, even though that brings a lot of rearchitecting just to make it wo
[Corion]: ... work
[erix]: interesting...
erix especially likes the "alot is not a word" muttering

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2017-06-24 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (557 votes). Check out past polls.