CodeNewbie Community 🌱

Nic
Nic

Posted on

Learning a bit about... Perl

Introduction

I've been spending my Saturdays doing tutorials on languages I'm curious about. This week it's Perl.

What I knew about the language before I started

  • It's old

What I did

I couldn't find any tutorials for creating a project on this, so I did the Learn Perl tutorial

What I thought about the language

I thought it would be a bit boring just learning the basics, but it quickly went completely off the rails when it turns out that you have to prefix a variable with a different symbol depending on whether it's a scalar, array or hash. And the symbol for a hash is not a hash (hash starts a comment).

So that kept things interesting. There was a lot that was like JavaScript, until we came to subroutines. Where it turns out you can send it arguments, but you don't write them out in the function definition, they're there all by themselves. And are scalars, so you can't just send an array in, you have to send in a reference to it, then inside the subroutine you can dereference it to change the scalar back into an array. Which is mad. I can see that if I was writing Perl the first thing I'd need to do in a subroutine is to note down everything I'm sending into it because I will forget and try and do something different every time I call it.

It's not awful, but I think given the choice I'd rather not program in Perl.

What's next?

F#. Which I know nothing about (except that it works in VS Code).

Latest comments (0)