Hi All,
Has anyone ever tried to use a variable for a file handle, as in:
OPEN ($file, "/home/working/logname" )
where $file changes, meaning the handle can be 1, 2, 3, 4, 5 depending on what the variable $file is.
I have a program which opens a tailed log file, and works perfectly well the first time:
open (LOG, "tail -f -n 25 ${batch_script_directory}LOG_$_[0]|") or die "Tail file error: $OS_ERROR:\n\n${batch_script_directory}LOG_$_[0]";
Yet after closing LOG and reopening it for the 2nd time, I get this error:
"?Error: Can't locate object method OPEN via package Tk:Event:IO on program line"
I can't see why Perl would not care the first time through, but every time after even if you close and reopen filehandle LOG.
The only solution I can think of is to have LOG a variable and change it each time through. Been stuck on this searching the web for ideas for about three days.........
Has anyone ever tried to use a variable for a file handle, as in:
OPEN ($file, "/home/working/logname" )
where $file changes, meaning the handle can be 1, 2, 3, 4, 5 depending on what the variable $file is.
I have a program which opens a tailed log file, and works perfectly well the first time:
open (LOG, "tail -f -n 25 ${batch_script_directory}LOG_$_[0]|") or die "Tail file error: $OS_ERROR:\n\n${batch_script_directory}LOG_$_[0]";
Yet after closing LOG and reopening it for the 2nd time, I get this error:
"?Error: Can't locate object method OPEN via package Tk:Event:IO on program line"
I can't see why Perl would not care the first time through, but every time after even if you close and reopen filehandle LOG.
The only solution I can think of is to have LOG a variable and change it each time through. Been stuck on this searching the web for ideas for about three days.........