> 
> 
> What do I need to do in order to use a filehandle that was 
> opened earlier in
> a program within a subroutine?  I've included an example of 
> the code I have
> that is not doing what I would like.  Basically, I never get 
> any output to
> the file.  If I change it so that it doesn't use the 
> subroutine when writing
> to the filehandle, it works fine.  What am I doing wrong?
> 
> Thank you in advance for any help you can provide.
are you sure this code works at all?  you have a bunch of things in caps!!

> EXAMPLE CODE
> #########################################
> $logfile = "/var/log/logfile";
> Open(FILE,">>$logfile");

always add error checking. 

> 
> While(1) {
>    &event_log("Logging some data");
>    sleep 60;
> };

do you need and endless loop? when I tested, it seems as the loop gets stuck
at the sleep. If you try a different condition in the while loop it will
work:
my $i = 1;
while($i < 10) {
&event_log("Logging some data");
sleep 1;
}

> Sub event_log {
>    print FILE "LOG MESSAGE: $_[0]\n";
> };




 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to