Remix.run Logo
JSR_FDED 8 hours ago

Is it worth learning Perl 5 these days? Maybe to use as a better Bash?

spudlyo 8 hours ago | parent | next [-]

It's definitely more powerful and has less foot guns than bash, the problem is the stigma is worse than bash. You will face more scrutiny and possible derision from your colleagues for using Perl than bash. It's not just questioning your taste or style either, it's because of the fear they might have to one day maintain or try to understand your Perl.

I speak from some experience. Because I'm a 90s UNIX nerd, I quickly hacked up a a bunch of stuff in Perl maybe 6 years ago to solve some text processing tasks for a compliance audit. It worked well and got the job done within the time constraints. I actually got some kudos for getting our team out of a jam and doing grungy work people weren't keen to do. My teammates though, they lost no opportunity to dunk on the fact that it was done in Perl, and questioned my decision at every opportunity. I ended up rewriting the whole thing in Python for our next audit.

JSR_FDED 7 hours ago | parent [-]

The opinion of coworkers is not a factor - but I have a friend who says that he has to relearn Perl every time he needs to use it. Do you have to use it every day to maintain fluency?

spudlyo 4 hours ago | parent | next [-]

It doesn't take too long to get back into the swing of things. After a while, if you learn enough programming languages, they all tend to meld together in your brain, and the cost of switching isn't too disruptive. You know what you want to do, it's just the details that temporarily get in your way.

hn_acc1 3 hours ago | parent | prev [-]

Yeah, as someone who occasionally had to hack on perl scripts - and I mean, maybe add/modify a hundred lines to add a new feature, then nothing for a few months, I found this too. Stop doing it for a while, and I had to relearn it all over.

I'd probably have an easier time getting back into REXX that I last used in 1992 or something..

cestith 8 hours ago | parent | prev | next [-]

It’s strong as a better shell. Perl is even getting an increasingly good and complete default object model in the core language. One of the big complaints was always that the TIMTOWTDI included object libraries, of which there are many. Most of the popular ones are working on becoming wrappers around the new core one, and you can write new code directly with what’s in core.

shagie 3 hours ago | parent | prev | next [-]

The question is "what do you want to use it for?"

There are a few places where you might dig and find a perl script under the covers. Some that aren't replaceable with bash (and sed and awk).

I suspect that my "diff these two java deployments and create a file by file update script to run on the remote machine" in perl is still running for doing incremental deployments... and if someone uncovers it its still something reasonable to understand.

However, if I was tasked with that today... dunno. I'm not sure I'd reach for the same tools as I did then.

> In devops is turtle all way down but at bottom is perl script.

https://x.com/DEVOPS_BORAT/status/248770195580125185 (2013)

> If you can not able use Perl for answer, you are ask wrong question.

https://x.com/DEVOPS_BORAT/status/280900066682757120 (2012)

... and while I can't find the original - this might be your answer.

> We have 3 strike rule for devops: 1 strike we are take away Perl. 2 strike we are take away bash. 3 strike we are give PowerShell.

https://gist.github.com/textarcana/676ef78b2912d42dbf355a2f7...

BeetleB 5 hours ago | parent | prev [-]

> Maybe to use as a better Bash?

If you know Python, just switch to xonsh (https://xon.sh/). I've been using it as my primary shell since 2018.