20230913-relearning_perl.txt
Yesterday I literally dusted off my "SAMS Teach Yourself Perl In 21
Days," copyright 2002. I used Perl almost exclusively back when I was
in college taking an Intro to Unix class. In fact, I'm not 100%
positive I used it then--I believe my professor used Perl to create
his presentations. But I digress.
A long time ago (in a galaxy far, far away), I created a sports team
rating system. It was very simple, as you do, but required quite a bit
of data, namely scores. I initially wrote it in C++ (my go-to at the
time for compiled languages) and it required a LOT of manual data
entry. I'm talking around 50-ish games per week and however many teams
were in the league (in my case, over 100). They were all stored simply
in text files, the output was similarly stored it text files, and as
an amateur programmer, it didn't sort the values well if at all.
It sort of lay dormant for a few years as I had the brilliant idea to
use a Big G Sheet instead. While I didn't have to enter as much data,
a table is not a database and having to manually link losing scores
into the respective team's formula was tedious without a proper DB
query. And while I did actually create a Transact-SQL database in
Microsoft's database program that was free/not Access, I didn't
maintain it much and I didn't like that SQL required a server or
platform-specific program. It's a database of mostly-static data, not
a DB of usernames. Also the relationships were often quite trivial, as
well. This is why the C++ version could feasibly use a flat file DB.
It was pretty clear later on once I took a step back for the first
time since those first drafts that all I'd really need was to update a
master score list and the rest could be taken care of via scripts. I
basically put it off as life and more human pursuits occupied more of
my time. But now I have nothing better to do and I figured building up
my programming experience wouldn't be a bad way to spend time. I have
successfully done some basic arithmetic and parsing with Perl (a bit
more and less complicated than using a bash script--bash sucks at
math). It's really not much, but I'm excited. The hard part is going
to be more advanced calculations and probable generation of many more
text files per team to calculate the ratings for each team. I would
like to use grep, but Perl predictably uses its own substr function to
extract streams (as opposed to depending on varying system functions).
I'm also a bit worried that the book is out of date, but it seems like
Perl hasn't changed a whole lot since 2002. The book claims to cover
Perl 5.7, but Perl is up to 5.32 on my system. That is probably
version math meaning 5.7 is actually 5.07 and 5.32 is 25 "minor"
revisions later.
Final thoughts: It's always weird using these "Learn $language in $num
Hours/Days/Weeks" books. Most of the time the first 2 lessons are
completely useless to seasoned programmers and a lot of the info I
need for this project is further down the line. I get that you're
allowed to read ahead and stuff, but it does come off as weird.
Considering my Perl knowledge is shaky at best, It's also weird
because I want to learn the basics while to write what I'm writing, I
need the advanced stuff. But that's how it goes for many programmers,
I guess.