Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: process redirection

by bofh_of_oz (Hermit)
on Jul 25, 2005 at 13:17 UTC ( [id://477803]=note: print w/replies, xml ) Need Help??


in reply to process redirection

system function only returns the exit status of the command; if you want to capture the output, you should use backticks:

$result = `command`;
Then, you can write this output to wherever you want it with something like this:

open OUTFILE, "> /path/to/outfile.txt"; print OUTFILE $result; close OUTFILE;
 

Alternately, if you do not want to process the output in Perl, you can just do something like this:

system("command > /path/to/result.txt");
However, in this case you probably wouldn't need to use Perl for it at all...

HTH

--------------------------------
An idea is not responsible for the people who believe in it...

Replies are listed 'Best First'.
Re^2: process redirection
by reasonablekeith (Deacon) on Jul 25, 2005 at 13:33 UTC
    but it's his executable that is generating the cab/exe file, it's not being returned on STDOUT. If this was the problem, he'd be complaining that he wasn't generating cab's/exe's at all, not just that they were in the wrong place.

    He needs to change directory as per pbeckingham suggests and anonymized user 468275 demonstrates. (or pass an output file parameter to his exe, if it has one)

    ---
    my name's not Keith, and I'm not reasonable.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-04-24 10:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found