Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Website for small perl scripts

by harangzsolt33 (Chaplain)
on Oct 22, 2018 at 06:05 UTC ( [id://1224436]=perlquestion: print w/replies, xml ) Need Help??

harangzsolt33 has asked for the wisdom of the Perl Monks concerning the following question:

Is there a website where Perl programmers share their scripts that actually do something useful? For example, I began learning Perl a couple of years ago, and right now I am writing a script for myself that looks at all the JPG files on my hard drive and removes duplicates. But I think others have probably written scripts like that before. Right? Is there a website where people share their scripts for free? I can find tons of websites that teach Perl. But I want to download programs that actually do something. If I look for other source codes such as C or C++, the internet is literally full of source codes. I can find the C source code for almost anything! But so far I haven't found a lot of Perl scripts. Are people not into sharing too much? Here is the script I am working on right now:

http://wzsn.net/perl/deldup.txt

Replies are listed 'Best First'.
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.

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).

      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.

        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.

        That's true, and see File::Compare. Hashes have the advantage that they can be cached and written to a file for later comparisons; personally I always usually use hashes (although typically one of the bigger SHA variants).

        "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.

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.

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.

Re: Website for small perl scripts
by Anonymous Monk on Oct 22, 2018 at 06:18 UTC
Re: Website for small perl scripts
by Anonymous Monk on Oct 22, 2018 at 06:26 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1224436]
Approved by kcott
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-19 21:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found