← Thu, Nov 12 digest

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

read article ↗ hn thread ↗

A humorous April Fools' paper claims 93% of paint splatters, when processed via OCR, result in valid Perl programs.

summary is enough It is a joke piece from SIGBOVIK; the value is in the punchline and the community's nostalgic reactions to Perl.

summary

The author used OCR software to convert images of paint splatters into text strings and found that the vast majority parsed as valid Perl. This is primarily due to Perl's flexible parser and 'unquoted strings' feature, which treats alphanumeric sequences as strings. The project was submitted to SIGBOVIK, a satirical conference for 'fruitful procrastination'.

key points

  1. The 'study' found that only 7% of paint splatters failed to parse as valid Perl.
  2. Perl's ability to treat unquoted alphanumeric sequences as strings allows random noise to be interpreted as valid code.
  3. The author used Tesseract OCR, and some commenters noted that the results depend heavily on the OCR's interpretation of the images.
  4. The paper includes examples of splatters that evaluate to 0 or short strings like 'c' and 'E__'.

who should read it

Programmers who enjoy language trivia, esoteric coding, or satirical academic papers.

discussion warm

consensus

Most commenters recognize the piece as a joke and appreciate the whimsy, while others use it as a springboard to discuss Perl's legacy as a 'write-only' language.

pushback

A few users argue the result is meaningless because it depends on the OCR software rather than the paint splatters themselves.

best comment by 0xbadcafebee ↗

The remainder of the valid Perl programs are mostly valid due to a Perl language feature that is not commonly present in most programming languages. Namely, Perl has a feature called “unquoted strings”, in which a sequence of alphanumeric characters by itself is parsed as though it were a quoted string. As an example, Figure 5 is read by OCR as the text ME, which evaluates to the string “ME” even though the ME isn’t quoted. This would result in a syntax error in most other programming languages.

(To be fair to Perl, when perl is run with the -w flag to enable warnings, it does helpfully …

It explains the technical reason why this happens: Perl's 'unquoted strings' feature allows alphanumeric noise to be parsed as valid strings.

Generated by an LLM from the article and thread. Check the sources before relying on it.