logoalt Hacker News

andrewl-hntoday at 5:26 PM2 repliesview on HN

Very good, actually. But you have to nudge them slightly. Tell them you prefer the modern version of the language, with gradual typing† and function signatures, and you'll get very good results. Perl interpreter comes standard on modern OSes and due to permissive licensing and impeccable backwards compatibility you can always assume you deal with very modern versions of Perl.

I write Perl scripts that are 10-100 lines of code, and at this size Perl is a Strictly Better Bash: better syntax, some type checking, better text support, and still effortless calls to external processes: essentially you put a command with arguments in backticks, and you get it's output. Ruby can do it too, but not all systems have it. Python is another obvious choice but calling external commands in it is annoying. I also use Perl for some one-liners as a better `sed` for text replacements.

† Perl nowadays have TypeScript-style type checking for function parameters. So, while the syntax is wild sometimes, the language is much better than it used to be.


Replies

throwaway27448today at 6:12 PM

Are you talking about perl 5 or perl 6?

show 2 replies
hrmtst93837today at 8:32 PM

Assuming every OS ships new Perl is a good way to lose a bet, since RHEL and CentOS are happy to hand you a system package from years ago.

All the gradual typing and signatures in the world do not matter when the interpreter on the target box is old enough to miss half of it, and then you are dragging in CPAN modules or juggling shebangs just to get the same script to run everywhere. Bash at least advertises its limits. Perl can look like a nicer shell tool right up until deployment turns into a version scavenger hunt.

show 1 reply