Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: process redirection

by bofh_of_oz (Hermit)
on Jul 25, 2005 at 13:17 UTC ( #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...


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 SimonClinch 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://477803]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2018-05-22 22:16 GMT
Find Nodes?
    Voting Booth?