Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^2: best way to keep a simple count?by brian_d_foy (Abbot) |
on Apr 11, 2005 at 21:27 UTC ( [id://446780]=note: print w/replies, xml ) | Need Help?? |
Some experts gave you bad advice. You need to read and update the file as one step, otherwise another process comes along and tries to do the same thing while you are in the middle. Either the count doesn't get incremented properly (both processes read the same value before either one wrote a new one), the count gets reset (one process reads the file just after it was truncated), or the count disappears.
-- brian d foy <brian@stonehenge.com>
In Section
Seekers of Perl Wisdom
|
|