LOG in not assigned...
and also, I think you can't use a variable for FILE print.
You cant use 
print LOG "some output";
but not
print $print "some output";

Another way to do this is to redirect stdout/stderr in case you have lot of
machines and 
use the print command.
example :

$manymachines=1;
open(STDOUT, ">c:\\logfile") if $manymachines;
print STDOUT "test\n";
close(STDOUT) if $manymachines;

Yves

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:extern.Lars.Oeschey@;audi.de]
Sent: Tuesday, October 22, 2002 12:20 PM
To: [EMAIL PROTECTED]
Subject: writing to either STDOUT or Logfile


Hi,

I have some subroutine that tests either one machine or a bunch of them. If
it's a single machine, the "print" statements in the subroutine should go to
stdout (no change needed for this, that's how it works now), if however I
want to test a lot of machines, I want the "print" statements redirected to
a logfile.

from a "logical" thought something like this:

if ($opt_l) {
        open Logfile;
        $print=LOG;
}

sub test {
        print $print "some output";
}

so if $print is empty it prints to stdout, if it contains LOG it should do a
"print LOG 'some output';".

somehow my logic doesn't work though, what's the correct way?

Lars
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to