93% of paint splatters are valid Perl programs (2019)

https://www.mcmillen.dev/sigbovik/

515 points by ellieh on 2024-04-29 | 124 comments

Automated Summary

In a study looking to answer whether it's possible to paint on a wall without creating valid Perl programs, an analysis of paint splatters using Optical Character Recognition (OCR) revealed that 93% of the paint splatters were valid Perl programs. The study identified and presented seven paint splatters that did not parse as valid Perl programs. These findings were presented at SIGBOVIK 2019, and a gallery of the paint splatters, along with the Perl programs, can be found in the paper. Subsequent errata identified more 'interesting' paint splatters with unique Perl evaluations.

Other submissions

Comments

tromp on 2024-04-29

Concatenative languages [1] have the property that every token sequence is a valid program.

For languages using single bits as tokens, every bit sequence is a valid program. One such language is Chris Barker's zot [2].

Inspired by zot, I defined a concatenative version of Binary Lambda Calculus that shares the same property [3].

[1] https://en.wikipedia.org/wiki/Concatenative_programming_lang...

[2] https://en.wikipedia.org/wiki/Iota_and_Jot#Zot

[3] https://cstheory.stackexchange.com/questions/32309/concatena...

deathanatos on 2024-04-29

> Concatenative languages [1] have the property that every token sequence is a valid program.

I don't think this is correct? Concatenative languages have the property that if a and b are both valid programs, that the program a || b is valid (where || means "concatenate"). But that property doesn't imply that every sequence of tokens is valid.

For example, in Cat,

  [1 2
is not grammatically valid.

tromp on 2024-04-29

You're right. I should have qualified it as "some concatenative languages".

joshmarlow on 2024-04-30

Is there a particular term for concatenative languages with this property?

contravariant on 2024-05-01

Trivially it's all concatenative languages where each single token is valid.

Not sure if they have a name but I would be tempted to call it a free language.

YeGoblynQueenne on 2024-04-30

So does Prolog count as a concatenative language given the standard definition of concatenative languages?

For context, a Prolog program is a set of definite clauses so the union of two Prolog programs is a Prolog program.

In fact, this property forms the basis of the concept of (syntactic) generality in Prolog: if P1, P2, P3 are three Prolog programs such that P1 is the union of P2 and P3, then we say that P1 generalises each of P2 and P3. Does this concept of generality also exist for concatenative languages?

dheera on 2024-04-30

They used an OCR program though, which probably has a bias toward attempting to close parentheses.

kqr on 2024-04-29

> making Jot a natural Gödel numbering of all algorithms.

This sounds very cool. I wish I understood both Jot and that sentence.

tromp on 2024-04-29

A Gödel numbering is simply a mapping to integers (that is easily decoded). If your programs are arbitrary binary strings, then you're basically already done, since bitstrings are in 1-1 correspondence with integers:

    empty  0  1  00  01  10  11  000  001  ...
        0  1  2   3   4   5   6    7    8  ...

kqr on 2024-04-30

But doesn't Gödel numbering imply some sort of uniqueness, i.e. that each algorithm is only present once?

Otherwise, wouldn't any language assigning a valid meaning to any sequence of 0 and 1 be a Gödel numbering, even if only by saying that "an unrecognised sequence is a noop"?

DougBTX on 2024-04-30

No, an algorithm may be written in many ways, each of which would encode to a different Gödel number.

> To encode an entire formula, which is a sequence of symbols, Gödel used the following system. Given a sequence (x_1, x_2, x_3, ..., x_n) of positive integers, the Gödel encoding of the sequence is the product of the first n primes raised to their corresponding values in the sequence

https://en.wikipedia.org/wiki/Gödel_numbering

tromp on 2024-04-30

Yes, in order to be decodable it must be an injective mapping.

Dylan16807 on 2024-04-30

> A Gödel numbering is simply a mapping to integers (that is easily decoded).

"easily" is arguable. Sure, I could multiply/factor an enormous number and count how many copies of each prime it has, but I'd much rather concatenate/split some digits.

thaumasiotes on 2024-04-30

Factoring numbers is difficult. Manipulating digits is easy, or it looks that way, but this is partially an illusion resulting from the number being given to you with the digits already known.

If you have a quantity in mind but you're not sure what its digits are, it can be a lot of work to learn.

Dylan16807 on 2024-04-30

I don't know what you mean by "not sure what its digits are".

If you mean what base to represent the number in, that's no more arbitrary than knowing the exact way Gödel numbers use primes.

pmontra on 2024-04-30

Maybe it's an unfair example but: the number of people on Earth. We know the quantity more or less, the leftmost digit in base ten, then it's a lot of work to figure out the other digits.

Dylan16807 on 2024-04-30

Definitely unfair, because we're discussing this as a way to encode and decode a string of numbers into a single number, no measurements involved.

And factoring the number of people on earth would be just as hard.

contravariant on 2024-05-01

You don't need to factor, if you know the nth prime you can easily find what value is at the nth position.

If you're clever about the way you write your syntax tree you can limit the primes to below 13 or so. Don't think there are many useful language constructs that consist of more than 5 or so terms (I think you can limit it to 3 if you encode lists as (list a (list b (list c nil))).

interroboink on 2024-04-29

I enjoyed footnote 5:

⁵ This feature does enable a neat quine: the Perl program “Illegal division by zero at /tmp/quine.pl line 1.”, when saved in the appropriate location, outputs “Illegal division by zero at /tmp/quine.pl line 1.” The reason for this behavior is left as an exercise for the reader.

fanf2 on 2024-04-29

I wrote a blog post to explain it at https://dotat.at/@/2019-04-04-a-curious-perl-quine.html

And also a superficially-related but actually rather different Python quine:

  File "quine.py", line 1
   File "quine.py", line 1
   ^
 IndentationError: unexpected indent

LeifCarrotson on 2024-04-29

Can you help out a reader who does not know any Perl?

I tried it in the REPL and found that "Illegal division" can't locate method "illegal" in package "division", so presumably that gets ignored, same with method "by" in package "zero", and that "at /tmp" is the simplest version of the string that produces the error message, which apparently is more severe than the missing package warnings and terminates the program?

I'd guess the / is the operator for division, and the "tmp" is getting initialized as a variable and coerced into an integer? But "/tmp" doesn't do it, and "/tmp/" does something with regex, so I'm not sure why the parser would split it there.

interroboink on 2024-04-29

The footnote is originally referenced here:

    Figure 6 represents the string “gggijgziifiiffif”, which by pure
    coincidence happens to accurately represent the authors’ verbal reaction
    upon learning that “unquoted strings” were a feature intentionally
    included in the Perl language.⁵
So, the hint is that this has to do with the "unquoted strings" feature (aka "bare words"[1]).

See the sibling comment about the actual parse — "at" and "tmp" are seen as strings.

The strings get coerced into numbers due to being used with the numeric "/" operator (that's normal Perl behavor). Since the strings can't be parsed as numbers, they become "0". So, you get division by 0.

[1] https://perlmaven.com/barewords-in-perl

thaumasiotes on 2024-04-30

> The strings get coerced into numbers due to being used with the numeric "/" operator (that's normal Perl behavor). Since the strings can't be parsed as numbers, they become "0".

Huh, that's an odd failure of Perl's normal ethic of doing things that appear to make sense in context. A number should be 0 by default in additive contexts and 1 by default in multiplicative contexts.

andai on 2024-04-30

Non Perl user here: why do people love Perl but hate JS? I imagine Perl had a lot more thought put into it (than JS's 10 days), but this kind of implicit conversion sounds like exactly the kind of thing that bites me in the ass constantly in JS land.

(Actually, implicit unquoted strings sound so nightmarish it's comical, but let's do one question at a time...)

I used to think the solution was static typing, but then I found none of the same infuriating bugs in Python, which has dynamic but strong typing, forcing you to be explicit about type conversions.

Edit: I think I've hit the nesting limit, so please reply to parent comment and I will find it.

smueller1234 on 2024-04-30

Former Perl language contributor here. A sibling comment to this already pointed out that you must use strict mode with Perl to retain your well being.

The two languages certainly both have their terrible warts. I think in the implicit conversion gotchas, JS is actually markedly worse. Perl has polymorphic values, but somewhat typed (for its basic types) operators (eg "eq" for strings, "==" for integers). JS has both implicit value type conversions and overloaded operators. That leads to an unholy level of indeterministic mess.

TheDauthi on 2024-04-30

When using Perl you should `use strict; use warnings;` and you have something approaching a real language with a lot fewer warts, in which said quine is not a valid program. It isn't the default because Perl people have an obsession about not breaking backwards compatibility.

I think the people that love perl love its expressiveness. It has a little bit of functional programming here, and a system for making an object-oriented language, and all of these handy tools and you choose which ones you need or find most readable. I've heard Ruby called a better Perl, and - as someone whose day job is largely those two things - that's completely fair.

smueller1234 on 2024-04-30

Many moons ago, I made a case for making strict mode the default in Perl. We settled on the current backwards compatibility compromise, which is that breaking changes are hidden behind a minimum version toggle:

Eg. putting "use v5.14.0;" or similar on top of your file (or compilation unit/scope) will indeed turn on strict mode for you, along with adding a number of features as well.

At the time, also auto-toggling warnings was considered unacceptable because technically, using the warnings pragma anywhere had some edge case action at a distance. This has been remedied in some later release after I wasn't involved in the language development anymore, and from some more recent version, warnings are also part of the standard import.

I imagine you (TheDauthi) already know that, though.

araes on 2024-04-30

Javascript has a Much larger user community. You get much different behavior and discussion when the community's enormous, it's one of the most used computer languages anywhere, and it's available on almost every device with no additional software. Partial example, StackOverflow question counts (measure of community volume and topic need). 2,529,945 questions on JS. [1] Perl? 68,116. [2] (as of 4/30 when linked)

Possible effects: People that must use Javascript, but don't want to (only choice, only framework). People that use Javascript because it's hyped or hot, not because of personal interest. Larger volume of talk, so more opportunities for griping. Much larger perception of griping (blogs, HN links, news. You almost have to work to find the Perl griping locations). The talk tends to more work issues (stuck on project, annoyed at issue), and not discussing a language you write with because you enjoy the features.

[1] https://stackoverflow.com/questions/tagged/javascript

[2] https://stackoverflow.com/questions/tagged/perl

lozenge on 2024-04-30

I think developer experience was bad all round "back in the day". Eg PHP didn't have stack traces, query parameters were automatically set as variables (and quotes escaped with backslashes... Depending on your sysadmin's config...) Compilers would produce broken binaries instead of erroring. By comparison, most people learning JS since Web 2.0 have experience with friendlier languages.

asddubs on 2024-04-30

PHP had this too in earlier versions. so if you missed an import that defined constants, the constants would just evaluate as their names. People liked to use this particularly for associative array indexes like $array[userid] instead of $array['userid']. Naturally a terrible idea because the inverse is also true in regards to constants, defining a constant named "userid" would then change the meaning of the program

hoytech on 2024-04-29

Easiest way is to Deparse it:

    $ perl -MO=Deparse tp.pl 
    'division'->Illegal('zero'->by('at' / 'tmp' / 'quine' . 'line'->pl(1)));
    tp.pl syntax OK
So I believe this is what causes it (note that "at" and "tmp" and such are "barewords"):

    $ perl -e 'at / tmp'
    Illegal division by zero at -e line 1.

kqr on 2024-04-29

It might be when you run Perl with no qualifier you get a recent version of Perl which turns on strict warnings for you, and (rightly) warns about undefined words instead of quietly trying to evaluate them anyway.

But yes, it converts the strings to integers and divides them, as shown in the sibling comment.

TheDauthi on 2024-04-30

By default, even on a recent perl it'll act like you're on a really old perl and run just fine.

With warnings, it runs, but tells you about all of the mistakes you made. With strict, it doesn't run.

teaearlgraycold on 2024-04-29

You can do this with Python as well for indentation errors

dang on 2024-04-29

Related:

93% of Paint Splatters Are Valid Perl Programs (2019) - https://news.ycombinator.com/item?id=27929730 - July 2021 (163 comments)

Also:

93% of Paint Splatters Are Valid Perl Programs (2019) - https://news.ycombinator.com/item?id=38754686 - Dec 2023 (1 comment)

broken-kebab on 2024-04-29

Jokes aside, isn't it wrong that OCR software still always produces textual result from images wich are not text? More than a decade ago I OCRed an old book, and I remember how annoying it was to deal with all the garbage text produced from small pictures, smudges, and dirt. It looks like there's not much progress done since in the field

kzrdude on 2024-04-30

That question seems to be the same kind as the question in the OP. Isn't something wrong when a random scribble creates a valid execution in Perl?

jonahx on 2024-04-30

> It looks like there's not much progress done since in the field

LLMs help here. From my own experiments chatGPT is pretty good "smart, context-aware" OCR agent.

Kubuxu on 2024-04-30

Using image embedding and evaluating 100s billion parameter LLM for OCR is like hunting rabbits using Yamato’s 18in naval gun.

manquer on 2024-04-30

Well using a human is bring an interstellar rail gun to hunt rabbit so i guess it still better ?

jonahx on 2024-04-30

Not really. Proper OCR in the broadest sense (extracting text from arbitrary pdfs that intermingle tables, images, etc, or from hand written artistic posters) requires a full understanding of semantic intent.

You are perhaps imagining more constrained scenarios of straight lines of consistent text on a page with well-known artifacts of "noise" (smudges, print imperfections, and so on).

petters on 2024-04-30

Yes, there has been progress. But the featured article is meant to be fun!

glenstein on 2024-04-29

I understand that this discusses recognizing paint splatters as characters with a given "optical character recognition" program, which seems disposed to almost always recognize pain as some combination of characters. Of the many possible ways this could be realized, this is absolutely welcome and in the spirit.

However, it did give me the initial impression about other possible ways to do this, such as taking patches of color and empty space as 0s and 1s, and the totality of it as a program. I think the vast majority of those cases would be pointless noise.

So there's two extremes, one with mostly noise, one with mostly meaning. I suppose the game-within-the-game here is to find what form of interpretation does the most to credit paint splatters with the most possible meaning where, to the greatest extent possible, the meaning truly comes from the structure and not from how aggressive the rules are at choosing to see meaning.

bee_rider on 2024-04-29

> disposed to almost always recognize pain as some combination of characters.

Well, break out the eeg, let’s see if pain is also a valid perl program.

EvgeniyZh on 2024-04-29

The opposite is definitely true

hnzix on 2024-04-30

Just make sure you don't accidentally autoviviy another instance of yourself.

akurtzhs on 2024-04-29

“What’s in the box?”

“Perl.”

iamleppert on 2024-04-29

With Generative AI, you can create new and innovative paint splatters that evaluate to working software, faster than ever before. Generative AI enables a new class of creators to harness and leverage text to image workflows, driving value for businesses of all sizes. New AI models are capable of embedding working software and machine readable codes into a wide variety of high resolution content, engaging viewers and providing creators new and exciting ways to grow their audiences.

dmbche on 2024-04-29

More cutting edge computational research here : https://sigbovik.org/

neilv on 2024-04-29

Clever variation on the old "indistinguishable from line noise" jokes.

(For those who weren't frequently exposed to "line noise"... Imagine an ASCII character video terminal that's interpreting a stream of bytes, to display meaningful text. Now imagine that the communication channel gets corrupted somehow (say, someone picks up the phone handset while modem is online, or there's interference on the cable), and there's no error correction or checksumming, so the bytes being interpreted are effectively become randomized. So random letters, digits, punctuation, control characters, etc., are being interpreted and displayed, and this is familiar, and you know it's random and why... but the joke is that it's still actually a valid Perl program.)

saalweachter on 2024-04-30

Great, now you've made me realize that line noise is in the same category of things I'll never be able to explain to Kids These Days (like broadcast schedules), and now I might as well get it over with and tie an onion to my belt.

Mathnerd314 on 2024-04-30

> (source code not available yet because i am bad at GitHub)

Lost forever I guess. Certainly it's not at https://git.mcmillen.dev/explore/repos

0xbadcafebee on 2024-04-29

as a Perl programmer, I consider that non-functional 7% a bug

syadegari on 2024-04-30

Tangentially relevant to this is Perl Secrets, a list of operators and constants discovered by various users: https://github.com/book/perlsecret/blob/master/lib/perlsecre...

lupire on 2024-04-29

Cute idea, and useful research to answer the question, but the experimental result is essentially nothing. None of the examples generated anything semantically more complex than `0-0`.

Many scripting languages will tolerate meaningless input.

Instead of these extremely non-character-istic splatters, I think scribbles or random raster bitmaps would be better input.

eternityforest on 2024-04-29

If it tolerates meaningless input, that means you could accidentally hit a key, type garbage in a file and the compiler would have no complaints...

I've done this many times, trying to use the search bar and then having the debugger suddenly plop my cursor into a file....

I get what people are going for, but I don't think I would enjoy coding in Perl!

thyrsus on 2024-04-30

1. git complains about the uncommitted changes

2. When intentionally writing perl, half the time my "perl -c foo.pl" complains about syntax or badly used names (usu. misspellings), with the typo to correct being obvious. As a practical matter, it's not a problem.

I see a lot of semicolons in that ocr output, which might be cheating.

eternityforest on 2024-05-01

Git complains about uncommitted changes but it won't complain if you just like, open a random file and hit a key.

I'm sure it has some level of checking, but it doesn't seem anywhere near like what you get in Rust or MyPy.

I generally find dumb mistakes and typos take more time to solve than type annotations and verbose syntax take to write.

mrguyorama on 2024-04-29

>but the experimental result is essentially nothing.

Sir, this is SIGBOVIK.

jhdias on 2024-04-29

Posted 1st April. This implies something.

gfldex on 2024-04-29

    $ cat ~/.signature
    --

    raku -e 'try { not :2(.fear) } and do not die'
    perl -e 'do not $fear and do not die'
    raku -e 'say „The Road to Wisdom“; $*ERR and $*ERR and $*ERR but Less and Less and Less'

stcredzero on 2024-04-29

"is it possible to smear paint on the wall without creating valid Perl?"

This is just a matter of syntax, right? So could it be determined by a stack machine? Unfortunately, the answer is no. Perl is not context free!

https://perlmonks.org/?node_id=663393

As just a guess, this question maps to the Halting Problem. (EDIT: That would have to be the question where the input is a programming language, not just for Perl. That question has been answered empirically.)

Jsisn on 2024-04-30

I don't understand how that is done. Can someone explain to me how to do the same? Whether it is reading the raw image, a particular format or the bytes of the print. Surely it's not like that, like I said I don't understand.

tlarkworthy on 2024-04-30

The OCR (optical character recognition) is doing the heavy lifting, essentially forcing the blotches into strings... which then turn out to be valid perl programs

cies on 2024-04-30

I've come to prefer languages that score very low on this metric of "paint splats OCRed yield valid $PROG_LANG programs".

A lot of fun I had with a language called Elm, in which runtime errors are nearly impossible to express.

rrr_oh_man on 2024-04-29

I love the splatters — what’s the copyright on those?

Manabu-eo on 2024-04-29

They gathered images from pinterest.

methods21 on 2024-04-30

I so wish Perl was still in the 'mainstream' and Perl 6 didn't fizzle. Love Perl.

mlhpdx on 2024-04-29

Interesting, but the social relevance would be improved if the input images were graffiti.

tenderfault on 2024-04-30

is the ocr system written in perl by any chance?

mrighele on 2024-04-29

Now I am wondering the percentage of programs written in Piet [1] that are also valid Perl programs, and if there is any instance where the are two are actually the same.

[1] https://esolangs.org/wiki/Piet

sakesun on 2024-04-30

More than a decade ago, I heard a big consulting firm executive stated that he deliberately base his project on Perl, because his team will have less chance to find a new job elsewhere from this skill. :|

Iris2645 on 2024-04-29

Such a bullshit article.

Bjartr on 2024-04-29

That's entirely the point.

legitster on 2024-04-29

Unrelated, but what a garbage original tweet that this is taken from. Getting taught useful skills is not mutually exclusive to kids being kids.

It would have been nice to have learned how to use a drill press in school rather than the Dewey Decimal System. What do you even think school is for? I didn't come from a very privileged background - no one was going to hand me a career when I turned 18.

"I wish I'd had more time to be a kid". I'm a grown ass man and I still read books too late and splash in puddles. It sounds like you just decided not to be fun one day and are blaming other people for you being boring.

prisenco on 2024-04-29

I agree with the original tweet, because I interpret it as a message to parents pushing their kids. There are a lot of parents these days that are hyper-obsessed with their child's success and that can easily lead to a loss of childhood. I've seen it happen, I'm sure you have too.

This is not about the kids who love to learn things that end up being useful skills. By all means, let them learn. But don't stop the kids who like to run around in the woods or fingerprint or pop wheelies on their bike for the sake of their future career prospects.

legitster on 2024-04-29

I don't disagree with your sentiment, even though I am also not a person who looks back fondly on my childhood.

The fact that the tweet specifically calls out schools "teaching vocational skills so young" makes me interpret the tweet as a generic luddite response - as if Montessori schools don't make working with hand tools an explicit part of their early childhood curriculum! This does seem like she is opposed to her kid learning and not an anti-Tiger Mom take.

lern_too_spel on 2024-04-29

This is a privileged Western attitude towards child rearing. "I turned out fine without hard work, so you will too." I've seen far too many of those kids get a rude awakening when they reach adulthood.

itishappy on 2024-04-29

Playing outside, painting, and bicycles are privileged Western things?

lern_too_spel on 2024-04-30

Not stopping them from doing that when it risks their future prospects is a privileged Western attitude.

prisenco on 2024-04-30

"risking future prospects" in this context has not been clearly defined.

lern_too_spel on 2024-04-30

It was clearly defined in the comment I replied to, which is the context of this thread. I am using the same definition.

prisenco on 2024-05-02

No it wasn't. Be more specific.

lern_too_spel on 2024-05-03

That comment specifically mentioned risking future career prospects. That is clearly defined to me. If it isn't clearly defined to you, you need to fix your wording to communicate what you actually meant by that.

sandworm101 on 2024-04-29

>> What do you even think school is for?

At that age? Daycare. Sending all kids to government-run schools freed up the parents to work longer/harder jobs. But I would never argue for kids not to get schooling. I know too many adults who cannot read properly, who cannot write a cohesive paragraph, who don't know affect from effect. Kids need more reading, not less.

zer00eyz on 2024-04-29

I learned about computers so very young. Not in the sense of consumption in the sense of "what you can do with code"

TO this day, writing code, feels like play. I get the same child like satisfaction that building something out of lego would give me, that sense of "Look what I did".

diob on 2024-04-29

I think you're reading way too much into it with little context. For instance, we don't even know how old the kid is, or if the workload on the kid from school is super high.

tedunangst on 2024-04-29

If you learn the Dewey Decimal system, you can go to the library and find a book to teach you to use a drill press. On the other hand, if you take a drill press to the library looking for a book, ...

laurowyn on 2024-04-29

...you can mark all the books you've checked with a hole so you know you've checked them.

Work harder, not smarter. /s

Jokes aside, I still agree with GP, in that there are more practical skills that are left out of education that would be far more useful in day to day life. The Dewey Decimal System has been replaced with search engines.

I don't need to know how a search engine works in order to type in "how to use a drill press" and read the results. But that's because the knowledge and understanding of how computers work at a high level circumvents the need to do that - a search engine is a form, give it something to search and hit the submit button. Easy.

Being taught by someone to use machining tools helps build an understanding of how every day items are made using those tools, so you have a more fundamental understanding of the items could be combined together into other more interesting things, repair them, take them apart and service them.

It's almost the opposite problem of maths in schools. We're taught maths in various incresasingly complex ways, all the way up to calculus. Those methods teach us how to use maths to do clever things. But every day maths doesn't need that. We're taught compound interest, but we have to use that to figure out how to do our taxes by ourselves without any help. Wouldn't it be nice to have an overlap there, hit two birds with one stone and we all walk away with a stronger understanding of the world?

If we're not taught how to make things, we struggle to learn how things are made, which means less things get made. Learning how to make things early, and embedding the knowledge of how things are made, enables more things to be made in future.

tedunangst on 2024-04-29

Yeah, sure, today we can teach people to use a search engine and whether you should believe the first result. Is the chatbot always truthful? Not sure when or why it was decided that media literacy isn't a useful everyday skill.

gofreddygo on 2024-04-29

serious question: What good is perl in 2024.

Follow up: where do you see it going.

Full disclosure: never implemented anything useful in perl in my personal or professional capacity for the last decade, except for debugging a few scripts here and there.

toast0 on 2024-04-29

I learned Perl in or around 1996; and it continues to work well for practical extraction and rubbish listing.

I've used Python when it was convenient, but I dislike it. So Perl remains my go to when I need to process data for more than a shell script.

Things I've written in Perl that I've run recently (or are croned so they run frequently) include: scripts to monitor shared directories for changes (kqueue) and publish the changes to a remote server so my spouse can drop images or other files to be shared on a share and get a link to send, or edit a recipe and check it from the web while shopping; my monitoring script that checks if my computers are working and emails me if not, it also reboots my dsl modem when it needs it; (for work) a tool to grab stats files from production, compute a summary, and then upload it so clients can be routed to the servers that are best for them.

I've done all sorts of stuff with Perl in the past, it's a very capable language.

kqr on 2024-04-29

After over a decade of programming in various more and less popular languages, I became a manager. I no longer had time to write real code but I needed to be able to automate things still, so I learned Perl.

Then I discovered one of Perl's best kept secrets: it allows you to write real code, if you want to.

Now I'm back to being a regular programmer again but I just happen to be more productive with Perl than anything else.

I have written about it before[1] but it boils down to one thing: it runs anywhere with no modification or installation, even 20 years from now.

[1]: https://two-wrongs.com/why-perl.html

interroboink on 2024-04-29

I think the old comment by Larry Wall about “manipulexity” vs “whipuptitude” still holds true. Perl occupies a powerful ecological niche in the space of programming languages. The space has become more crowded over the years, but it's still hard to beat Perl if you're experienced with it. CPAN is a big part of this.

As to the future... Perl 7 is coming (:

https://www.perl.com/article/announcing-perl-7/

seti0Cha on 2024-04-29
melagonster on 2024-04-30

perl developer community found this probably isn't good ideas, so they decided to keep this version number for some important updates. maybe after the experiment end of "class feature" in newest version.

tootie on 2024-04-29

Perl is a Turing-complete language that runs on any platform and has maybe the longest-standing repository of open-source libraries. I haven't seen a benchmark recently, but I'd bet it still outperforms Python or node. But yeah, you'd be laughed out of any job for suggesting it be used for any serious work. It lost the PR war years ago.

I used it as my primary language for several years and it's extremely capable and intuitive. The learning curve of it's syntax is really only slightly longer than any other language. And I have the very strong opinion that syntax contributes less than 5% of readability and the rest is up to the developer to factor smartly and name things well.

diputsmonro on 2024-04-29

Agree! I will add that it's actually very possible to write Perl in a readable way (at least no more unreadable than your average bash or python script). It's all up to the developer to write readable, maintainable code instead of trying to impress themselves with their esoteric one-liners.

With the light syntax and giant, well-documented community repos, it feels a lot like Python With References to me, which is honestly pretty great imo. I wish more people respected Perl.

xandrius on 2024-04-29

To be fair neither node nor python are where they are today because of their performance.

I wish we could leave them behind as a fun phase of mass adoption of programming and fully switch to strongly typed languages alone. One can dream.

tootie on 2024-04-29

As much as I enjoyed Perl, I also cannot fathom how these kind of languages got so much adoption. For me, productivity is most strongly correlated with IDE support, debuggers and documentation. These are the kind of things Java and C# beat everyone else at. But it seems like a lot of devs are just dogmatically tied to their text editors.

krupan on 2024-04-29

"cannot fathom how these kind of languages got so much adoption"

The other options built into your UNIX (maybe Linux) machine were:

- C

- C++

- tcsh/ksh/bash

- awk

- TCL

What would you have chosen?

kamaal on 2024-04-30

Apart from Python, even today what are the options?

golang/rust/c doesn't fit well the kind of tasks you would use Perl to do. There is simply too much verbosity and at some point in time you will bail out of the sisyphean nature of the task. Kotlin etc are more for mobile apps.

To me, back end work is-

1. Any serious application, that needs to run for years with performance - Java.

2. Glue work- Python/Perl.

xandrius on 2024-04-30

I wouldn't dismiss Go that quickly, and same for C#.

troglodynellc on 2024-04-30

A lot of the "dogmatically tied" comes from experience; it's why the common refrain is that IDE means "It Doesn't Exist" (where you have to fix the code). E.G. a "this is why we can't have nice things" situation.

This is why a lot of us still use vi/emacs; it's just what's available where we have to fix the problems.

I'll give you an example. I used to contract with booking.com, where they gave us a crippled little windows "amazon workspace" over vnc which we had to use to talk to their systems. They're transitioning from a perl shop into a java one, so naturally they use an IDE. Unfortunately, they have configured this little workspace such that SSH mounting your dev VM into an IDE isn't possible (due to it not having a workable ssh agent), and you can't install anything not pre-approved (so x11 forwarding a locally installed IDE is right out).

Minor changes could have been made to these workspaces to address this; requests for which went ignored for years.

The only thing I could rely on was what I am used to writing perl in. An SSH console session with vim and tmux.

I was quite glad to have java experience from before the days when java IDEs were any good. I'd have been screwed if I didn't know how to use the debugger and javac directly.

We've all had to work with our hands tied behind our backs often enough we just "skip to the end" and use the tools we know for a fact will always be available.

It's probably that same reason that perl persists to the level of popularity it has. Like vi, I know it's going to be there on basically any server I have to work on, and the client probably doesn't care/want or even know how to provision me something less primitive.

tmtvl on 2024-04-29

Perl has a very strong documentation culture. One of the things I miss in Common Lisp is the ability to just do 'perldoc List::Util' and get an overview of all subroutines in that module, with examples and clear explanations of how it all works.

xandrius on 2024-04-29

Yeah, many people are happy with their IDE not letting them do something incorrectly (if they have extensions X, Y, Z installed), I prefer having something incorrect being impossible to exist.

krupan on 2024-04-29

correct vs. incorrect encompasses so much more than memory safety and types that agree. You could spend a ton of time making the ADA or Rust compiler happy only to discover your program doesn't solve the problem your customers want solved. That's why Python is still so very popular

selimthegrim on 2024-04-29

I am reasonably sure Rentrak in Portland still uses Perl.

HeckFeck on 2024-04-29

I've found that I can most easily express myself in Perl. I love the feeling that you can never truly exhaust the language. I hated the indentation at gunpoint and overall sterility of Python, and JavaScript is much more disjointed than what anyone imagines Perl to be.

My most recent task using it was writing a backup script that connects to various systems, archives stuff, then copies it to a NAS and then updates a backup log.

Before that I created a demo site for a business idea using Mojolicious (Perl web framework) + DBIx::Class (Perl ORM), and I believe we could have completed the project using them. But due to concerns that we couldn't find or pay Perl programmers when we scale we abandoned it for a rewrite in C#/ASP.NET. A heart vs mind decision, but business needs came first. I'm aware that I'm the only one of my age (early 30s) in my circles who has learnt Perl.

And that previous sentence is why I fear for its future.

daneel_w on 2024-04-29

As Larry Wall said, Perl makes easy things easy and hard things possible. Almost the entire backend of my telecoms employer is written in Perl, and as a result of sticking with it we have a code base which is lean and runs fast and efficiently. Both of these are strong benefits that I'll always defend as far more important than people are willing to admit.

I don't see Perl going anywhere. Neither back towards popularity, nor further into obscurity.

gfldex on 2024-04-29

> What good is perl in 2024.

Making Debian possible. Allegedly, the German banking system is held together by Perl scripts. Which is good. Perl got 0 bitrot. And you don't want your bank account to rot, do you?

exe34 on 2024-04-29

leftpad not found. Your fortune has been deleted.

0xbadcafebee on 2024-04-29

A few years ago I used it do to a KeyPass migration, because the KeyPass libraries in every other language didn't work.

I wrote a different Perl script as a Sysadmin 20 years ago and used it last year. Still works.

Another time I was doing something and wanted to grok some horrid DSL (cough HCL cough) and in 20 minutes wrote a script to parse thousands of files give me what I wanted. Still use that script.

Where's it going? No idea, don't care, I'll probably keep using it for the next 25 years.

troglodynellc on 2024-04-30

I make my entire living modernizing various firms' perl stacks.

There is a never-ending amount of work for people who are good at modernizing older mod_perl/cgi stacks into psgi, and profiling/optimizing stuff.

Where I see perl going:

I see the big firms running away from it as fast as they can, and getting pikachu face when they inevitably get second-system effect, but nevertheless doubling down, because admitting failure is a no-no unless during a reorg.

I see the mittlestand and small biz expanding their existing use of perl, as they cannot afford to re-tool. Perl programmers will continue to have active careers for another 20 years, which is at least as long as I need to remain employed.

The language itself will continue to evolve at a snails' pace due to being design-by-committee since our BDFL retired. Thankfully this doesn't seem to be a particularly serious problem, as no advances in programming language design have come forth which are the kind of quantum leap in either dev productivity or performance to matter for our use cases.

kamaal on 2024-04-30

>>What good is perl in 2024.

Pretty much anything that has to run on Unix(or unix like machines). Its special niche is glue code and automation related work. Use case for that happens quite frequently than one imagines.

There is a also a 'blub' nature to it as well. Many times unless you have used a tool, it can be hard to see what use case it fits in. Last two weeks I had to do a fairly heavy automation related thing at work. Bash was not suitable because the code would get big as the situation evolved. The tool has to be something using which is present everywhere(rules out things like golang, java), something in which you can rapidly prototype, something that is very good at manipulating text and something that works very well with Linux utils(Rules out python, golang). Over two weeks its size grew to something like 3K lines, and I have used it to automate hours of boring manual work, overall I think I ran it like 30 times or so.

Perl is also good at generating text which has some structure. So I have used in the past like a macro utility in languages that don't have macros. Basically I generate code using Perl. I have used this to generate python, pig and even java code many times.

Other types of work are for glue, like cron scripts, clean up, regular test scripts, rapid prototyping etc.

CPAN makes the whole experience awesome. Its still the fastest evolving library base compared to any language, only competition may be is js. You will find a library for nearly anything you want. And for something that you can't find, Perl is good at rapid prototyping. Compare this with something like Clojure, where even language goes without maintenance for months. Perl is still actively developed.

Another big factor can be commitment to backwards compatibility, you can be sure your scripts from years back will run on newer versions of Perl.

>>Follow up: where do you see it going.

Perl is here to stay. Its installed on nearly every machine you can put your hands on, and even teams don't use it, Over the years I have seen individuals use it as some sort of a personal automation and productivity language. Like a secret tool.

I guess a lot of banks, telecommunications, manufacturing and early internet companies use it heavily till date.

Basically so as long need for automation exists, Perl would exist.

layer8 on 2024-04-29

You can be certain that a Perl program will still work unchanged in 2034. And it’s probably not going anywhere, both in the good sense and the bad sense.

legitster on 2024-04-29

I'm sure there are a few professional applications that support Perl, but the one that comes to mind is Radiator.

https://radiatorsoftware.com/

My understanding is that Perl is still somewhat popular in the sysadmin world - where just being able to push code that works is valuable.

hnzix on 2024-04-30
kelipso on 2024-04-29

Perl is flexible and cool while Python is for dorks and rules nerding losers. nasally voice huehuehue required indentation.

emmelaich on 2024-04-30

I only use it as an alternative to a stream of awk/grep/sed/...

Usually much more concise, readable and faster.

drivers99 on 2024-04-30

I use it for in-place search and replace within files.

perl -pi -e 's/change this/into this/g' filename(s)

-p assumes an input loop around your script. Lines are printed.

-i in-place editing of files

-e may be used to enter a single line of script. Multiple -e commands may be given to build up a multiline script.

Combined with "find" with -exec and/or pipe the filenames into xargs and you can do a global search and replace across a whole tree of files.

emmelaich on 2024-05-01

Yep, but for that example, sed has a -i too.

Also I recommend adding a backup for inplace edits.

man perlrun recommends -spi.orig

m000 on 2024-04-29

[flagged]

luxuryballs on 2024-04-29

why is Perl like this??

ramon156 on 2024-04-29

"is he stupid?"