execute a unix command

W

Walter Roberson

:Hi all, how can i execute unix commands from perl?

Several different ways, with different effects:

qx(command), `command`, system(command), open(command|)
open(|command), fork and exec the desired command... and I'm
sure there's others.
 
T

Tad McClellan

Walter Roberson said:
:Hi all, how can i execute unix commands from perl?
qx(command), `command`,


(those two are the same thing)

system(command), open(command|)
open(|command), fork and exec the desired command...


You can use exec() without fork() too, but the semantics of that
are not often desired.

and I'm
sure there's others.


I'm not.

I think you got them all (apart from modules).
 
W

Walter Roberson

|> In article <[email protected]>,

|>:Hi all, how can i execute unix commands from perl?

|> and I'm
|> sure there's others.


|I'm not.

|I think you got them all (apart from modules).

Well, there is .xs and other perl extensions. ;-)

I thought of mentioning modules, but I realized that those
could only call upon existing language features. Using modules
can certainly make for cleaner code, though!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,082
Members
48,773
Latest member
Kaybee

Latest Threads

Top