in reply to Thread to read a file every second
It is not clear why you need threads to do this, more detail might be in order. perlthrtut would be a good point to start for info on threads.
my $file = '/path/to/some/file'; while(1) { if ( -e $file ) { # read file # do stuff # unlink $file; # otherwise we will keep finding it } sleep 1; }
If you want to use simple code like this you will want to daemonize it. There is a example of daemonizing on my scratchpad
cheers
tachyon
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Thread to read a file every second
by TedPride (Priest) on Oct 06, 2004 at 08:24 UTC |