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.
...you might be eaten by a grue...
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||