Hacker News new | ask | show | jobs
by nerdponx 1310 days ago
Every time I try to write Perl, between the sigils, weak support for numbers, and the archaic-feeling way of handling parameters in subroutines, I come away slightly disgusted. The convenience of the text processing routines is not a novelty or productivity improvement compared to other languages nowadays. And Perl seems slower than Python now on the kinds of workloads where I would be tempted to use Perl. What am I missing?
2 comments

In the latest Perl5 you can define signatures like normal people[1], but it has been available as an experimental feature since 5.20[2].

[1] https://perldoc.perl.org/perlsub#Signatures

[2] https://www.effectiveperlprogramming.com/2015/04/use-v5-20-s...

That's a huge quality of life improvement, and I didn't realize it's been around for so long! I will have to give this a try.
>And Perl seems slower than Python now

Do you have some examples? Outside of some specific python extensions that are written in C, Perl is almost always faster than Python for me.

I don't have good ones offhand, but whenever I write a script that spends a long time looping and doing a mix of numerical calculations and text processing, CPython beats Perl. I think this is partly due to how Perl treats numbers as a kind of second class data type.

However Perl handily beats CPython in startup time, so it's much faster for short-lived programs.