file redirection

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a perl program that opens and writes to a logfile, this all


if (! open (LOG, ">>$logfile"))
    print STDERR "Cannot open logfile $logfile $!\n";
    exit 1;

print LOG "Hello world\n"

I want to redirect the outpuf of a system command ot the same
log but I am having trouble getting it to work.

Can I do something like this? If not, how can I get this to work.
system("kill -USR1 \"$1\" > LOG 2>\&1");

When I issue this command  on the command line I get a permissions
problem. When I run it from the perl script I was expecting to see the
same permssion problem in my log file.

THanks to all who answer

Re: file redirection writes:

Quoted text here. Click to load it

You really should read the answers given before you re-post your
code in a slightly different (but still misguided) form.

Joost Diepenmaat | blog: | work: /

Site Timeline