 |
|
Home:
Perl Programming Help:
Beginner:
Re: [StarkRavingCalm] Compare unchanged files in two arrays:
Edit Log
|
|

FishMonger
Veteran
Jan 8, 2013, 11:51 AM
Views: 1244
|
|
Re: [StarkRavingCalm] Compare unchanged files in two arrays
|
|
|
Use hashes instead of arrays. Comparing filesize is not the best way to determine if the file has been changed. You should compare the contents. The best approach to that would be to generate an md5 checksum and compare those. So, your hash keys will be the filenames and the value of each is the md5 checksum/digest. Digest::MD5 http://search.cpan.org/~gaas/Digest-MD5-2.52/MD5.pm Another choice would be File::Checksum http://search.cpan.org/~knorr/File-Checksum-0.01/Checksum.pm
(This post was edited by FishMonger on Jan 8, 2013, 11:54 AM)
|
|
|
Edit Log:
|
|
Post edited by FishMonger
(Veteran) on Jan 8, 2013, 11:53 AM
|
|
Post edited by FishMonger
(Veteran) on Jan 8, 2013, 11:54 AM
|
|
Post edited by FishMonger
(Veteran) on Jan 8, 2013, 11:54 AM
|
|
|  |