Re: Website for small perl scripts
by Your Mother (Archbishop) on Oct 22, 2018 at 06:23 UTC
|
github, bitbucket, here. Plenty of other places and code forums, I’m sure. It’s best, in my view, to put it somewhere like here where it will be a bit vetted.
| [reply] |
Re: Website for small perl scripts
by marto (Cardinal) on Oct 22, 2018 at 06:47 UTC
|
"If two JPG files have the exact same size, then we shall open both files for reading and we'll compare the first 70000 bytes. And if they are an exact match, then I assume that the two photos are the same."
That's a bad assumption, and one you don't need to make. If file sizes match just compare hashes (Digest::MD5, Digest::MurmurHash).
| [reply] |
|
If file sizes match just compare hashes (Digest::MD5, Digest::MurmurHash).
I don't know anything about MurmurHash, but MD5 has a higher chance of collisions than more modern hash digests. While, in all likelihood, this will not be a problem for this kind of usage, i would still go the recommended path of using something like SHA256 or even better SHA3-512.
See also:
"For me, programming in Perl is like my cooking. The result may not always taste nice, but it's quick, painless and it get's food on the table."
| [reply] |
|
Thank you for all the links! I am very glad. I do not have Linux, but I will try to install one to find the Perl scripts. :)
I think, in order to calculate the MD5 hash, we have to read the entire file. But if we're going to read the entire file, then why not just compare every byte? It would be less work.
| [reply] |
|
| [reply] |
|
"Thank you for all the links! I am very glad. I do not have Linux, but I will try to install one to find the Perl scripts. :)"
If you're on Windows or Mac you should also be able to install modules. What issue do you have?
"But if we're going to read the entire file, then why not just compare every byte? It would be less work."
If there were only two matching files a direct comparison would be quicker, since you don't know that this is going to be the case a hash makes more sense from a performance perspective.
| [reply] |
|
|
|
Re: Website for small perl scripts
by haukex (Archbishop) on Oct 22, 2018 at 08:16 UTC
|
Just to add one more to the list - AFAICT most of the scripts are quite old, and therefore not good starting points for new developments, but CPAN has a Scripts Repository.
| [reply] |
Re: Website for small perl scripts
by jwkrahn (Abbot) on Oct 22, 2018 at 06:44 UTC
|
If you have Linux installed then you have a lot of perl programs that do things. Last time I checked there were over 4,000 on my system.
| [reply] |
Re: Website for small perl scripts
by Anonymous Monk on Oct 22, 2018 at 06:18 UTC
|
| [reply] |
Re: Website for small perl scripts
by Anonymous Monk on Oct 22, 2018 at 06:26 UTC
|
| [reply] |