in reply to Re: Thread to read a file every second
in thread Thread to read a file every second

tachyon: Isn't that an endless loop? Also, he probably wants threading so his program doesn't stick endlessly or wait for x number of seconds for each file that isn't there. Better to wait x seconds rather than xn seconds.

EDIT TO PREVIOUS: I should have put in an end check parameter:

sub check_file { my ($fpath, $arrp) = @_; my $max = 15; my $handle; while (!-e $fpath || !open($handle, $fpath)) { return if (!$max--); sleep(1); } $$arrp = join('', <$handle>); close($handle); }