On 10/29/07, sivasakthi <[EMAIL PROTECTED]> wrote: > How to check the file is modified or not?
If the file exists at all, it's been modified at least once. But you seem to want to know something more. If you want to know whether the file has been modified since a certain time, you probably want some form of the mtime, the timestamp that you see when you use the 'ls -l' command, or your system's equivalent. You can use Perl's stat() function to get the mtime, or you can use the -M operator to measure the file's modification age in days. Both -M and stat are documented in the perlfunc manpage. If you want to know whether the file has the same contents as it once had, but you don't want to save a copy of the contents for comparison, you probably want to calculate a digest of the contents, and save that. (A digest is a short string produced by a cryptographic hash algorithm.) There are modules on CPAN that can help you to make a digest for your file; when the digest doesn't match, you know that the file has been modified. Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/