Perl programming

programming
I see there’s a python programming topic here, but I don’t see anything for perl. Python is cool and all, but I find perl more natural. It’s like the essence of unix and regular expression magic distilled into a language.

Anyhow, is there any interest in a perl category?

I know the whole perl 6 thing was a fiasco, but perl 5 has been developing nicely with new object oriented features, and perl 7 is on the way. I’ve been doing the perl exercises on exercism.org and it would be great to have people here to bounce ideas off of.

3 Likes

Yesh Perl still has a place, especially for sysadmin work, text processing, automation, etc.

Are you referring to this post?: Learning Python

Or another?

That’s probably it. I searched for perl and came up empty except for some mentions of python.

Perl, once called “the duct tape of the internet” is my favorite language for sys admin tasks, both for perl one liners, and for actual scripts, since it’s more expressive and powerful than bash for those things.

1 Like

I would find that interesting.

I’m not an expert with either one but as a retired person I took on a small project to implement a digital clock in as many different languages and scripts as possible: Perl, Python, TCL/Tk, C, Java and Bash. I didn’t do Ruby and plenty of other languages but it did give me some code examples that I can use if I want to code a function or quick tool.

C is the programming language I have down best; Bash shell is my most familiar scripting language.

5 Likes

I did a project where I implemented a program to count a huge password file and list the number of instances of each login shell. I started out with perl and python, pretty straightforward, then shell/awk, which was surprisingly concise. Then I added c, which was fun, since I had to do a sort of associative array from scratch. A few other people contributed programs in their language of choice.

Highlights -
c and rust were neck and neck for #1
go was fast. perl and python were fast, but surprisingly, php was faster.
Haskell was slow, but ms power shell was dead last by a mile.

The list of languages so far:
c
go
julia
lisp
ms powershell
node.js
perl
php
python
ruby
rust (thanks timotheosh!)
crystal-lang (thanks izder456!)
shell/awk

Other stats:
average program source code size = 22 lines
longest: c, 70 lines
shortest: awk/shell, 1 line

3 Likes

@J_J_Sloan you have me beat by a longshot on the number amd and diversity of languages.

I’ve toyed with Rust a tiny bit but mostly with programs that already use it.

I do have quite a few more languages in my long-term background but I have not used many of them in decades: Fortran, the very first language I learned, Algol, second language, PL/1, third language, Pascal, forth language and COBOL, fifth language.

Digital actually had a languages and tools organization and I was their admin for a while; these were some of the smartest people I’ve ever met, that is, other than the kernel developers of Digital UNIX. Those guys were ‘other worldly’ in their skills and THREE of them were at Michigan Tech in the 1975-1979 time period!

I had to work my tail off in the classes we took together; virtually all of us got 100% on most of our Computer Science exams. The problem I had was that I didn’t manage my time as well as I did later in my career and many other classes suffered, though I still did decently, just not as well as my high school grades.

In 1999 I went to grad school to prove to myself that I could do it, even with work and starting a family. I had a 100% score in all except my first and last classes. The last one dropped because I had to devote my time to find another job after one contract ended.

Anyway I survived a good career and now we chat about the things we’ve done.

4 Likes

Unfortunately I can’t take credit for all the programs. I did the c program, and the c-like languages (go, perl, php, python, ruby, julia) and the awk version, but outside contributors provided the rust, haskell, lisp, lua, crystal and node programs.

1 Like

@J_J_Sloan 99.5% or more of the code I write either leverages some syntax, style, or algorithm from elsewhere. Of course I create my own scripts but they benefit from the expertise of others.

Over my entire career I’ve probably created my own program 100% a few times; even those had inputs from others.

My one major contribution in my career was generating an idea myself, and establishing the architecture for it.

3 Likes

Hey, Brian, have you considered making that set of programs public, in order to help those, not familiar with one language or the other, to understand the concepts, constructs and implementations to congeal a given idea (a.k.a digital clock) using one of those specific languages?

That would be an amazing learning resource, to get an introduction to similarities and differences, for those trying to specifically re-target “small” projects into a different environment.

I think you mentionned teaching at one point! That could give you the vehicle to put that “cap” back on, if that was of interest! To expand on that concept, if you picked any pair of languages, then discussed the “mapping” from one to the other, explaining the limiting constraints for a given “transition”, or strategies of why certain approaches were chosen for the “target” language, would be an impressive mechanism for knowledge transfer.

Just thinking out loud!

:slight_smile:

3 Likes

If we have a mechanism to save zip files I could possibly zip up several of them;
Alternatively anyone who wants these could message me and I can put something together.

Might not be right away though; got stuff going on from later today through the weekend.

3 Likes

Brian, there is no rush, or expectation! Only offered an opinion on what might be useful to others. :slight_smile:

IF you do manage to collect the items, have you considered putting those up on a public site like

or if you want to host your own,

I’ve got some of my personal scripts published on GitHub. That may eventually find its way to GitLab, based on what GitHub is undertaking in the background.

3 Likes

You have some nice scripts there on github

3 Likes

Thank you, I appreciate the positive review!

That’s about 1/3 of my scripts. :slight_smile:

For my other scripts, some need some minor cleanup, a few critical ones (my firewall “suite”) need some major work, and the rest are “dinky” scripts which may eventually be uploaded, but only under a different grouping because they aren’t what I would call “sysadmin” class.

Do keep in mind that these are all intended for my only computer, my home Desktop ATX-based mid-tower.

3 Likes