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

Re: Newbie Question

by Malkavian (Friar)
on Oct 25, 2000 at 13:55 UTC ( [id://38313]=note: print w/replies, xml ) Need Help??


in reply to Newbie Question

The '?' in the argument makes me wonderif you're attempting to code some CGI.
If so, I'd suggest you check out CGI.pm.
The executing of a program from within perl is happily done using the exec command (perldoc -f exec).
Creating a file for output is as simple as:
open (OUTFILE, ">/path/to/file.txt") or die "Can't open file for text +output!\n"; print OUTFILE 'Some text you want to print to the file'; close OUTFILE;
In the open, note the direction of the chevron. If it points towards the filename, it writes to it. If it points the other direction, it reads from it.
There are other open modes, but that's just something to get you up and going
Hope this helps some

Malk *I lost my .sig. Do you have a spare?*

Replies are listed 'Best First'.
RE: Re: Newbie Question
by autark (Friar) on Oct 25, 2000 at 14:11 UTC
    While you are quite right that the exec function in perl can be used to execute a command, it is seldom used by itself. Usually it is preceded by the fork function call.

    To execute a program and fetch it's output, I would rather suggest either using the qx() construct or doing it by hand, open(F, "program|").

    Autark.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-04-23 15:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found