Live data from Hacker News

Not Your Grandfather’s Perl

stackoverflow.blog

111–120 of 257 posts

Re: Not Your Grandfather’s Perl

#111
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…

The `print` statement in perl has always behaved more or less as it does in the "other languages" you describe.

`say` removes the need for anyone to write their own "I'm tired of the manual newline ritual" function and provides a standard for where the newline is added. That's a marginal convenience, but given the frequency with which people either do write their own or newline inconsistency gets encountered (or both), it's a reasonable one.

And it's in pieces like this one not because it's a huge thing to crow about, but to illustrate the opt-in nature of incremental changes or sets of changes to perl.

`say` is also about 15 years old, like Time::Piece. The author is not announcing features that are new to the whole world, just new to a certain audience, possibly including the author.

This is also true of the filehandle scoping feature (which is 22 years old). If you find the old bare filehandle scope behavior only notable enough to hurl a drive-by "bonkers" at it then I suppose that's one way of advertising that you haven't spent much time thinking about unix shell utilities and associated features/issues.

Function signatures are slightly younger than typescript, or at least, the most familiar syntax for them; both the old and more recent means are essentially naming a list of arguments.

In general: perl is an opportunity to think about programming languages differently. There's a lot of contexts in which I never use it anymore, but it's rare to find people with substantial insights who casually disparage it.

Re: Not Your Grandfather’s Perl

#112
When I was about 20, I went to the local Barnes and Noble to find a book about programming.

Picked up the O'Reilly Javascript book from around 2000. Had no idea what javascript was, just wanted to learn how to program and trying to pick the most popular language.

$40 later, I got home and started reading! Very confusing, the first half of the book covered the language runtime (I think?) and the second half covered the browser sandbox, and it took me 200 pages to realize that I can't easily read or write to files on my machine with this language. Not what I was hoping for!

Back to Barnes and Noble, another $40 and I came home with the O'Reilly camel book, Beginning Perl I think? Cover to cover read, probably the last time I did that with a programming manual.

Decades have passed, I'm in the same camp as those that prefer Ruby now, but man what a breath of fresh air Perl was back in 2000.

Re: Not Your Grandfather’s Perl

#113
post #104

Perl receives such an unnecessary amount of hate

Those who've had to maintain someone else's perl tend to find that the hate is, if not strictly necessary, very much warranted.

Badly-written Perl code from the 1990s is not the fault of the language.

It's the fault of the non-programmers who read "Learn Perl in 2 hours and become a millionaire" books, had a massive s*t on a keyboard and started a business with it

Re: Not Your Grandfather’s Perl

#114

With function signatures and state variables added in 5.010, I consider Perl feature-complete and have not really missed anything from it for as long as I've been writing Perl. What I do appreciate that's missing from many other languages and systems is the extreme committment to backwards compatibility. The knowledge that the next minor release won't break existing scripts is underrated, IMO. Solo project with ~23K…

One of my criteria for good tools is that they scale well from the smallest possible use case to absolutely massive. Git meets this criterion for example.

Anyway I manage a 250kline code base written over 20 years which is in surprisingly good shape consider it's age and how many people have touched it. Last time we upgraded the perl for the first time in a decade - going through the addition of many features and major internal changes (e.g. unicode, optimisation) the total number of lines of code we needed to change was at most 50. And very little having to fiddle with underlying cpan libraries.

Back to the point. Throwaway script - perfect candidate. Code capable of running the money pump for a billion dollar company. Also just as fine as any other similarly capable environment, better than some, trickier to manage the team than others.

Re: Not Your Grandfather’s Perl

#115
The thing that kills Perl for me is its weak typing. Automatic variable coercions lead to data-dependent bugs. JavaScript has the same problem.

For scripting anything longer than a command line, I'll take Python.

Re: Not Your Grandfather’s Perl

#116
post #105
post #16

Earlier quoted context omitted.

Perl's bindings for Win32 and OLE are amazing.

Really? This is interesting! I had completely written off Perl for Windows due to its heritage. But we still use COM objects in our scripts here and while I like PowerShell conceptually, I really never got to have fun with it as a scripting language. It just has so many quirks like “implicit returns” etc. and is just so verbose it’s bordering on hard to read at times.

https://metacpan.org/pod/Win32::OLE

https://metacpan.org/pod/Win32

https://metacpan.org/search?size=20&q=win32

Re: Not Your Grandfather’s Perl

#117
post #62
post #16

Earlier quoted context omitted.

Perl's bindings for Win32 and OLE are amazing.

Would you have some interesting examples? I love Win32 because it's the closest we have to a universal GUI format for software.

https://metacpan.org/pod/Win32::OLE

https://metacpan.org/pod/Win32

https://metacpan.org/search?size=20&q=win32

Re: Not Your Grandfather’s Perl

#118
post #52

Earlier quoted context omitted.

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.

AFAIR, Red Hat stopped including Perl by default since RHEL8 (

Re: Not Your Grandfather’s Perl

#119
post #113
post #104

Earlier quoted context omitted.

Those who've had to maintain someone else's perl tend to find that the hate is, if not strictly necessary, very much warranted.

Badly-written Perl code from the 1990s is not the fault of the language. It's the fault of the non-programmers who read "Learn Perl in 2 hours and become a millionaire" books, had a massive s*t on a keyboard and started a business with it

And yet those non-programmers who instead "read "Learn Python in 2 hours and become a millionaire" books, had a massive s*t on a keyboard and started a business with it" tend to have ended up with something significantly less horrible to maintain.

Re: Not Your Grandfather’s Perl

#120
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…

CPAN was definitely the envy of other languages for many years but I feel most have caught up by now.

Kind of caught up. I don't think there's much like cpantesters and the strong emphasis on testing elsewhere.
Post reply on HN