Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: How do I execute UNIX commands from a perl script

by jwest (Friar)
on Nov 02, 2001 at 03:28 UTC ( #122715=note: print w/ replies, xml ) Need Help??


in reply to How do I execute UNIX commands from a perl script

For what it sounds like you'll want, the most you should need is to call system() with the commands you want to call. See the link for details on how to use it.

A quick and dirty example would be something like:

system("cp /foo /bar");

or

system("cp", "/foo", "/bar");

each of which do slightly different things. See system() or try a Super Search for more discussion.

Hope this helps!

--jwest

-><- -><- -><- -><- -><-
All things are Perfect
    To every last Flaw
    And bound in accord
         With Eris's Law
 - HBT; The Book of Advice, 1:7


Comment on Re: How do I execute UNIX commands from a perl script
Select or Download Code
Re^2: How do I execute UNIX commands from a perl script
by Anonymous Monk on Oct 15, 2004 at 16:08 UTC
    Just use backticks. to remove a file called file.doc all you'd have to do is put in your program `rm file.doc`; you might want to put in directories or whatever, but, I have found that to be the easiest way to execute unix command options from perl script

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2014-11-28 00:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (191 votes), past polls