Live data from Hacker News

Not Your Grandfather’s Perl

stackoverflow.blog

81–90 of 257 posts

Re: Not Your Grandfather’s Perl

#81

Perl receives such an unnecessary amount of hate

I don't think it's hate. I think it's more "why would I choose Perl over Python?" Perl has a painful syntax, Python greatly improves on this with easy syntax. I don't want to have to relearn the syntax every time I reach for a scripting tool.

> Perl has a painful syntax, Python greatly improves on this with easy syntax.

Regular expressions are way better in Perl. I increasingly find myself going back to Perl for RE heavy projects because it's so cumbersome in Python by comparison.

I'm still undecided on if Perl needing semicolons everywhere is only 'as bad' or 'worse' than Python forcing you to worry about the exact number of tabs/spaces indenting lines, but I'm leaning toward python being easier in that respect.

Still, when I have to get something done quickly, especially if it's an immediate need I don't see having to worry about later, Perl is what I turn to. Everything in Python becomes a "Project".

Re: Not Your Grandfather’s Perl

#82
post #59

Sorry, but what? The top features they highlight here are a print statement that adds a new line, a change to the bonkers default of creating some kind of implicit global named variable every time you open a file, representing time as an object (with a strftime function!) and… function signatures? I wouldn’t call this as “Perl moving forward”, I’d call this “Perl is still about 20 years behind everyone else”. Wait un…

[deleted]

Re: Not Your Grandfather’s Perl

#83

The current state of Perl 5 for Python fans: Perl 5: I'm not dead! TIOBE: 'Ere! 'E says 'e's not dead! Internet: Yes he is. Perl 5: I'm not! TIOBE: 'E isn't? Internet: Well... he will be soon-- he's very ill... Perl 5: I'm getting better! Internet: No you're not, you'll be stone dead in a moment. TIOBE: I can't take 'im off like that! It's against regulations! Perl 5: I don't want to go off the chart.... Internet: Oh…

[deleted]

Re: Not Your Grandfather’s Perl

#84

It's not objective, but I find I have more fun in Perl than any other language. The initial jump was steep, but it helped that I already knew some shell. Now I think in references, I can guess what $_ is going to be, I slap in a big, my $val = s/ /other_thing wherever I want, I could go on! I think $_ belongs to a different era, before levelling everything to the lowest common denominator became seen as a good thing.…

ugh $_ I successfully hide away all my bad perl memories and now it’s coming all back

Funny thing is: $_ is a valid Java variable name.

Re: Not Your Grandfather’s Perl

#85
post #23
post #14

Earlier quoted context omitted.

I'm working in Windows (employer's choice) and need to process some huge data files on the desktop. Perl (Strawberry Perl for Windows) is much faster than native Powershell (or CMD) scripts. A few Perl one-liners and I have 2 GB processed in a couple of minutes. Big fan of Perl here.

> A few Perl one-liners and I have 2 GB processed in a couple of minutes. This matches my experience: my task is IO bound, processing tens of GB in a matter of minutes. > I'm working in Windows (employer's choice) Work prefers MacOS, Windows is my personal choice :) Windows 10 and 11 are a pleasure to use: between the Windows Terminal and tools like AutoHotKey, there's no Linux equivalent, even for a commandline geek…

> > A few Perl one-liners and I have 2 GB processed in a couple of minutes. > This matches my experience: my task is IO bound, processing tens of GB in a matter of minutes.

Huh. Windows is usually anywhere between bad to horrible at IO compared to alternatives. 2GB processing (usually mixtures of regex, summarizing data, summing fields extracted) shouldn't take more than a few seconds. Even on a slow disk, say 100MB/s, we are talking 20s. On faster SSDs, and NVMe, its very snappy.

If you are waiting minutes ...

> Windows 10 and 11 are a pleasure to use: between the Windows Terminal and tools like AutoHotKey, there's no Linux equivalent, even for a commandline geek.

Huh. I'm happy that $dayjob gave me the option of getting off my horrible Dell workstation laptop (8 core, 64 GB ram, nvidia graphics) and onto a mac pro m1. While the keyboard diff is annoying, karabiner elements fixes most of that. I still ask for a linux laptop at ever opportunity though, as this is what I'm most functional with. Easily the best/fastest experience I've had for dev/admin, and the most stable. Mac is a close second.

Re: Not Your Grandfather’s Perl

#87
post #75

I've used Perl off and on throughout my career, even working at one job that was pretty much exclusively Perl. I've also used Java and C/C++. I've done a lot of work with embedded systems where C was the order of the day. But back to Perl. I always thought one of the best things about Perl was CPAN. I could nearly always find a module that would accomplish a specific task I needed and then I was just left to write th…

> But back to Perl. I always thought one of the best things about Perl was CPAN.

I'm a younger developer, so I wasn't around when Perl was super popular. I listened to the Corecursive episode about CPAN [0] and was really impressed. It's a good listen even if you're not that interested in Perl anymore.

[0]: https://corecursive.com/tdih-cpan/

Re: Not Your Grandfather’s Perl

#88
post #52

Earlier quoted context omitted.

I would argue that ruby as almost all the strengths of perl and conciseness with more coherency if you want a perl-like fluidity and terseness. I personally like python for anything that becomes more than a 100 lines of bash.

Does Ruby come pre-installed on virtually every Unix-like system out there?

No, and if it is, who knows what version it is.

I think that's the main thing preventing one from using ruby like this. It is otherwise preferable in pretty much every way.

Perl is kind of pre-installed on virtually every Unix-like system for what are at this point historical/legacy reasons. It is unlikely any other language can ever achieve this at this point.

Re: Not Your Grandfather’s Perl

#89
post #74

Please don't blame bare word file handles on "C heritage" -- Some of the improvements were needed because in places Perl’s Unix/C heritage shows through a little more than we’d like it to in the 21st century. One good example of this is bareword filehandles. You’re probably used Perl code to open a file looking like this: open FH, 'filename.dat' or die;

Maybe the thinking was that Perl's STDIN, STDOUT, STDERR, came from c's (well, stdio.h's) stdin, stdout, stderr? Which then inspired the bad idea of expanding on that?

It's more from sed/awk/shell I suppose.

eg, open FH, "vs FILE *fh = fopen("filename","r")

Post reply on HN