An easier way to do so could be using the AnyEvent module.
In the AnyEvent::Intro there is an example that does something very similar to what you are trying to do. See the Introduction to Event-Based Programming section (instead of using STDIN you can obviously use any file handle you want).
It has been implemented in the AnyEvent::Filesys::Notify module.
Just my 2¢.
In reply to Re: Seeking a better way to monitor a file's change
by alexbio
in thread Seeking a better way to monitor a file's change
by xbmy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |