Live data from Hacker News

93% of Paint Splatters Are Valid Perl Programs (2019)

mcmillen.dev

91–100 of 170 posts

Re: 93% of Paint Splatters Are Valid Perl Programs (2019)

#91
Most of this appears to be Perl's tolerance for "barewords" if you don't "use strict;".

I suspect this dates back to the Perl4 -> Perl5 transition, when they removed the requirement to call a subroutine using an ampersand, like &somesub could just be somesub.

Unlike, say Python, Perl doesn't require subroutines to be defined before they are called.

For reasons I don't fully understand, barewords preceded by '-' are still allowed, even with "use strict". Also allowed as hash keys like $foo{bar}=1 or (foo => "bar").

Re: 93% of Paint Splatters Are Valid Perl Programs (2019)

#92
post #2

Sometimes I forget how insane Perl was before `use strict;` became commonplace.

use English; is handy for making the special global variables something you can actually google search.

Google improved their negligence in 2019.

https://encrypted.google.com/search?q=%24_

Re: 93% of Paint Splatters Are Valid Perl Programs (2019)

#93

That's a fun read. I once wrote an entire CMS in Perl. I still wake up, screaming, sometimes. [UPDATE] It appears as if my flippant remark caused upset. I am sincerely sorry that this was the case. No offense was meant. @peteretep, you have my sincere apology. It was a flippant remark. At the time I wrote it (mid-1990s), Perl was the best way to write portable server-side code. I took the time to learn it, and got fa…

I recently had to work out why some nodejs monstrosity wasn't working. Somewhere in the 68,746 files that made up the program there was a problem.

I rewrote it in a couple of hours in 393 lines of perl and 6 OS installed (so stable for the life of the OS) libraries.

Re: 93% of Paint Splatters Are Valid Perl Programs (2019)

#94
post #91

Most of this appears to be Perl's tolerance for "barewords" if you don't "use strict;". I suspect this dates back to the Perl4 -> Perl5 transition, when they removed the requirement to call a subroutine using an ampersand, like &somesub could just be somesub. Unlike, say Python, Perl doesn't require subroutines to be defined before they are called. For reasons I don't fully understand, barewords preceded by '-' are s…

> For reasons I don't fully understand, barewords preceded by '-' are still allowed, even with "use strict".

I believe the primary motivation for this is so you can pass argument lists to subs in a key => value format without having to quote the key. For example:

  someSub( -opt1 => $opt1val, -opt2 => $opt2val );
[edited for formatting, which I never seem to get right the first time]

Re: 93% of Paint Splatters Are Valid Perl Programs (2019)

#95
post #45

Earlier quoted context omitted.

Fun fact: cPanel[0] is still written in Perl [0]: https://www.cpanel.com/

Booking.com also

tbh, I'm still sad that Python won against Perl during the heyday. Perl was and is still a fun language.

Re: 93% of Paint Splatters Are Valid Perl Programs (2019)

#97

Earlier quoted context omitted.

Nah. Wasn't edited, but it was definitely a slap at me, personally. I touched a nerve, and was reprimanded. It was not a "fun" response, and it made me realize that I had caused offense. Teh Internets tubes are a difficult landscape to navigate. It's almost impossible to write stuff without causing some offense. Some folks take that as an admonition to never write anything fun. Others (like me) learn to apologize. I'…

Looked like a good-natured but wry joke, not a slap.

This whole thread feels like a glorious exercise of Poe's Law.

I can't tell what's what, but man is it funny, to me it reads as deadpan humor by peterep with no insult intended, but obviously others read it differently.

Perspective is amazing and this has made my day from all the smiles and laughs XD

Re: 93% of Paint Splatters Are Valid Perl Programs (2019)

#98
post #61

Earlier quoted context omitted.

I don't see any need to apologise for what's clearly meant as a lighthearted joke. Just don't complain when someone comes up with a clever comeback :)

No, it wasn't lighthearted, but it wasn't vitriol, either. I touched a nerve, and got slapped. It's cool.

Just for another perspective- I read it as peter intended, a deadpan way of purposefully taking your statement literally, that you wrote code that made you scream, it wasn't Perl's fault.

I found it hilarious, but I'm a weird guy. I just can see where he is coming from where he meant it as a snide joke, not a personal attack.

Re: 93% of Paint Splatters Are Valid Perl Programs (2019)

#99
In university, I learned Perl out of curiousity. It was the first scripting language I tried; I was only familiar with Java, C and Scheme at the time.

After reading Programming Perl from cover-to-cover, I suddenly felt like I had superpowers. I probably would have felt the same if I'd taken the time to learn bash scripting, but that's not how it worked out.

I tried to automate everything in my life with Perl. I'd walk to class in the morning and a script had already scraped and downloaded my lecture materials and sent a print job for me. It emailed me if it couldn't find notes for one of my scheduled classes. Others would manage my assignment submissions. I wrote scrapers to detect what events on campus might offer free food.

This was the first time I felt like I could write programs that actually had the power to improve my life. It changed my perspective on what I had the power to do as a programmer. I'll always be grateful to Perl for that.

I also learned how to quickly develop a thick programmer skin by asking questions on comp.lang.perl, but that's another topic altogether.

Re: 93% of Paint Splatters Are Valid Perl Programs (2019)

#100
post #8

This is obviously just a bit of fun, but looking at the output examples, I think the OCR used may be flawed in that it's heavily optimised to produce characters used in natural language (alpha & spaces) rather than to produce e.g. operators common in code. The number of "special characters" output is extremely small. This will bias it heavily toward producing identifiers, which will be valid in most common programmin…

I don’t think that’s a flaw! The study is “95% of paint splatters” not “95% of random strings of ASCII characters”. If common OCR programs are optimized to produce letters and spaces, fair game! (You would of course want a “proper” scientific study to be more rigorous about these things.) Edit: Also, the programs in the article appear to be mostly special characters?

> Edit: Also, the programs in the article appear to be mostly special characters?

I assume you mean the 4 listed in the "Errata" section?

The full list is here: https://www.mcmillen.dev/sigbovik/splatters.html

Post reply on HN