in reply to Re: Re: Infinte perl script
in thread Infinte perl script

How long to sleep depends on the granularity of what you need. If the file gets deleted and you need to do something immediately, then a small sleep. If you just generally need to know it, perhaps a sleep 300 or <code>sleep 600<code> for 5 or 10 minutes would be appropriate. If you need to do something by the next day, sleep for an hour or more, who cares.

However, if your delay is big, a better answer might be to use a scheduler to run you check program instead of idle in the background. On a *nix box use cron, not sure on Win32 box. This isn't as worthwhile with a small delay because of the overhead of loading Perl.

While this may not use much CPU resources, since you are doing I/O, it is also using disk resources. I'd set the delay as long as you can stand.

=Blue
...you might be eaten by a grue...