PERL Programming Language

On this page you will find some Perl-related links and Perl scripts that I have written. If you find something useful and want to incorporate it into your program, feel free to do so. No need to ask for permission. Just copy and use whatever you like. I started learning Perl in 2016, so I am still a beginner. I use Notepad2 text editor and TinyPerl 5.8 on Windows XP, but all my scripts should run fine on Linux too. I make sure that my scripts can run well on Perl 5.004 on DOS as well.

Perl is a beautiful language. It's very versatile. It resembles assembly, BASIC, C and JavaScript in some ways. It is a mixture of several languages. Perl can be used for website back end applications as well as Linux/Windows scripting. Perl even runs on Mac OS and DOS. It usually comes preinstalled on Linux systems.

Perl Websites

Beginner's Perl Tutorial
Run Perl Online
Perl Examples
Perl Weekly Challenge
Perl Tutorial
Perl Paraphernalia
Strawberry Perl
Perl Begin
Free Perl Scripts
Free Perl Books
Source Forge
Perl tidy
Perl Hacks
Programming Books
Picking Up Perl
Perl Articles
Obfuscated Obfuscator
Perl Tricks
Perl Weekly
Programming Tips
Perl & Raku Conference
Perl Obfuscator
ActiveState Perl
Perl In 2.5 Hours
Perl Editor

My Perl Scripts

I use TinyPerl 5.8 on Windows XP. Unfortunately, many of the modules are not working on my computer, so I write my own sub-routines. I use this Perl "toolbox" file to grab what I need.

If you trade stocks, you will have to report your sales to the IRS. During tax season, Robinhood's platform allows you to download the trades in PDF form. Most PDF viewers allow you to convert the PDF to TXT. And this Perl script will convert the TXT to CSV so you can import it into Excel. If you make a lot of trades, this tool comes handy. It can save you days of tedious work and do it in 5 seconds. This program can also be useful for accountants who have to enter a lot of Robinhood trades. This tool makes it super fast to process a large number of trades. The output will show the security name, number of shares, date acquired, date sold, profit or loss, cost basis, wash sale, etc.

This program is the same as the one above, but this works for 1099 tax PDF files released by Charles Schwab brokerage firm. This program takes TXT files and converts them to CSV.

This ZIP file contains Notepad2, TinyPerl 5.8 for Windows (executable) and and It's 12 megabytes. This is all you need to run my perl scripts. Expand to a folder called C:\PERL and follow the instructions in README.TXT. (Note: Perl was invented by Larry Wall, and TinyPerl was built by Graciliano M. P. in 2003. Notepad2 was created by Florian Balmer.)

This perl script compares two directories. It compares directory1 and directory2, and displays a list of files and directories that do not exist in directory2.

This script solves the knapsack problem. The knapsack problem goes something like this: You have 100 items each with different size. And you have a bag which you must fill all the way to the top. You have to figure out how to fill the bag in a way that you end up with the least amount of empty space. This script tries to find a combination of numbers whose sum equals 500. The random numbers are between 1 and 500. The first script solves the problem step by step, displaying what happens at each step. The second script just solves the problem and displays the results without "debug" messages.

This tiny script was a programming exercise I saw somewhere. It sorts email addresses by domain.

This Perl script minimizes JavaScript code by removing comments and all non-essential spaces from a JS file.

This Perl script deletes duplicate JPG files within a directory. Sounds like a great idea at first, but it's not. If I have 3 identical JPG files called "Charles.jpg" and "Copy of Charles.jpg" and "Florida.jpg" then I want to keep the first one, but the program doesn't know how to come to that decision. So, it will ask the user each time what to do. This makes the program really slow. If you have thousands of duplicate files, it will take forever...

This Perl script demonstrates the QuickSort algorithm. This program sorts an array of numbers.

Displays the contents of a directory.

Analyzes file contents and displays what percentage of a file is binary vs plain text.

This script converts all Linux/Apple text files in the current directory to DOS format.

This function converts any binary string to plain text format that contains nothing but letters and numbers. The algorithm tries to compress the string by using a simple RLE algorithm and grouping characters depending on how often they are used. So, in some cases, the output will be shorter than the input. Most of the time the result will be smaller than what we can achieve using the escape() function or string2hex() function or base64 encoding.

This script displays the prime numbers under 1 million, and it contains functions for factoring numbers and finding the common factor.

This script calculates the first 15 digits of PI using the BBP formula which was discovered in 1995 by Canadian mathematician Simon Plouffe.