On 07/25/2006 02:23 PM, siegfried wrote:
I have some cron jobs running perl for many hours. Sometimes I would like to
control things dynamically or even shutdown the job if I notice it is not
running properly (based on the log files).
Below is what I am doing presently (inside a loop) and I feel there must be
a more elegant solution where I can label my values. Presently my file
"delay.txt" looks like
1
1
And I would prefer it look like
delay= 1;
continue = 1;
Thanks,
Siegfried
sub getDelay{
local *FILE;
my $delay;
my $continue;
open (FILE,"delay.txt");
$delay = <FILE>;
$continue = <FILE>;
$delay = $delay + 0; # force integer
close(FILE);
return ($delay, $continue);
}
sub getDelay {
use File::Slurp;
my $file = read_file('delay.txt');
my %file = $file =~ m/(\w+)/g;
$file{delay} += 0;
($file{delay}, $file{continue});
}
:)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>