93% of Paint Splatters Are Valid Perl, but Only After 12 OCR Tries. A Default Run Gives 0
I reran the SIGBOVIK paper's 12 Tesseract settings on its 100 images: 89 pass. One default run passes none, and 61 of the 93 published programs are three characters or fewer.
“93% of paint splatters are valid Perl programs” came back to the Hacker News front page this week, 572 points and a “(2019)” in the title.1 It is a joke paper from the SIGBOVIK conference, and it has been submitted to HN at least six times since 2019.2 The thread does what threads about this paper always do: people marvel at how forgiving Perl is, and a few ask whether the number means anything.
The paper is more candid about its method than most of the people repeating its title. It says outright that each image got twelve attempts and that one success was enough.3 What the title cannot carry is how much that matters, and what kind of “program” comes out the other end. The author published the full image set and the gallery of strings, so I reran the experiment and counted.
What the paper actually did
The pipeline has four steps. A person downloaded 100 images from Pinterest (search query “paint splatter wallpaper”) and removed any with watermarks. Each image went through OCR, which is software that turns a picture of text into characters. Whatever characters came out were handed to the perl executable to see whether it would accept them as a program. Only non-empty programs counted.3
The OCR engine was Tesseract 4.0.0-beta.1, and here is the part that shapes the result. Tesseract has three engines (an older “legacy” one, a newer neural-network one called LSTM, and a mode that combines them) and 14 page segmentation modes, which tell it what the picture is supposed to contain: a column of text, one line, one word, one word arranged in a circle.4 The author did not pick one. For every image he ran 3 engines times 4 modes (4, 7, 8 and 9), and the image counted as valid Perl if any of those 12 readings was accepted. The paper calls this “profoundly unethical” and notes there are no separate training and test sets, which is a fair description.3
flowchart LR
I["one splatter image"] --> L["legacy engine, modes 4 7 8 9"]
I --> N["LSTM engine, modes 4 7 8 9"]
I --> B["both engines, modes 4 7 8 9"]
L --> T["up to 12 strings"]
N --> T
B --> T
T --> P{"perl accepts any non-empty string?"}
P -->|yes| S["counted as valid Perl"]
P -->|no| F["counterexample"]
I -.-> D["control: one default tesseract run"]
D -.-> Q{"perl accepts it?"}What I reran
The author’s page has a tarball of the 100 images and a gallery with the string he kept for each one (7 are marked “Not valid” and have no text).2 His scripts are not published. I rebuilt the pipeline from the paper’s description: the same 12 combinations, a whitelist of ASCII characters 32 to 126 for the engines that honor one, dictionary features switched off, and perl -c (compile only, do not run) as the validity test. An empty or whitespace-only reading never counts.
Two things differ from 2019, and I cannot remove them. I used Tesseract 5.3.4 where the paper used 4.0.0-beta.1, with the eng.traineddata from the official tessdata repository at tag 4.1.0, because the Ubuntu package ships an LSTM-only file with no legacy engine.5 And the checking Perl is 5.38.2 in WSL, where the paper used 5.26.1. The whole run is about 1,300 Tesseract calls and takes under a minute.
Show data table
| Legacy | LSTM | Legacy + LSTM | |
|---|---|---|---|
| mode 4 (column) | 1 | 1 | 2 |
| mode 7 (line) | 13 | 18 | 12 |
| mode 8 (word) | 26 | 46 | 24 |
| mode 9 (word in circle) | 33 | 60 | 20 |
The reproduction is closer than I expected. The pure LSTM engine, taking the best of its four modes, covers exactly 74 images, the same as the paper. The other two engines are off by a few (legacy 55 against the paper’s 62, combined 45 against 40), and the union over all 12 settings is 89 images against the paper’s 93. I have no explanation for the four-image gap; the version differences above are the obvious suspects. Reading my strings against the gallery, 34 of the 93 published strings appear verbatim among my 12 outputs for the same image, which says the setup is similar and not identical.
One default run finds nothing
The control is what you would do without knowing any of this: run tesseract image stdout and feed the result to Perl. On the same 100 images that produced a non-empty string for 2 of them, and neither one was valid. The score is 0 of 100.
The chart above explains why. The modes that work are the ones that tell Tesseract the picture holds a single word or a single line. The default mode, 3, goes looking for paragraphs, finds none in a paint splatter, and almost always returns nothing. Mode 4 (a column of text) is almost as barren, with 1 or 2 valid images per engine. So the 93% depends on telling the OCR engine to produce a short answer and then letting it try again under different assumptions.
That second part is visible if you count, per image, how many of the 12 settings produced a valid string.
Show data table
| settings (of 12) that gave a valid reading | Images |
|---|---|
| 0 | 11 |
| 1 | 19 |
| 2 | 23 |
| 3 | 22 |
| 4 | 12 |
| 5 | 8 |
| 6-7 | 4 |
| 8+ | 1 |
Of my 89 passing images, 42 pass under only one or two of the twelve settings. Remove the right one or two settings and they fall out. That is what “best of 12” looks like in data: the headline is real, and it is a statement about the search as much as about the paint.
The programs are tiny
The paper says the valid programs are “uninteresting” and mostly “don’t actually seem to do anything when executed.” The gallery agrees. Of the 93 published strings:
| Property | Count of 93 |
|---|---|
| 3 characters or fewer | 61 |
| 5 characters or fewer | 72 |
| 10 characters or more | 7 |
Plain integers (35, -3, 225252) |
18 |
Letters only (pg, Nok, figigigg) |
53 |
| Everything else (punctuation, or letters mixed with digits) | 22 |
The median length is 2 characters and the longest is 22. I ran all 93; every one exits cleanly and prints nothing. My own OCR readings look the same: across all valid readings the median is again 2 characters and none spans more than one line.
Why is a string like figigigg valid Perl at all? Because without use strict, Perl treats an unquoted word it does not recognize as a string. These are called barewords, and the paper explains the feature correctly.3 Turn on use strict, which most real Perl files do in their first line, and the bareword becomes a compile-time error.6 I checked the 93 published strings with perl -c -Mstrict: 21 pass. They are the 18 integers plus -*?, ; and :. The other 72 fail with errors like Bareword "pg" not allowed while "strict subs" in use.
That is not a flaw in the paper, which never claims strict mode. It does change what “valid Perl” means, though, and the strict figure is the one closer to what a person means by a Perl program.
How much of this is just short strings?
A last yardstick. If most of the valid readings are one to three characters, validity may be mostly a function of length and not of paint. I generated random strings and checked them with perl -c. For each of the 93 published lengths, I made 10 random strings, drawn from the 60 distinct characters that appear in the published sources: 62.4% of those 930 strings are valid Perl. Drawn from all 95 printable ASCII characters instead, 45.4% are. By length, with 200 strings per point:
Show data table
| string length | Characters seen in the gallery | All printable ASCII |
|---|---|---|
| 1 | 83% | 63% |
| 2 | 71.5% | 54% |
| 3 | 62% | 47.5% |
| 4 | 60.5% | 34.5% |
| 6 | 45.5% | 28% |
| 10 | 36.5% | 16% |
| 20 | 22.5% | 7.5% |
| 38 | 12.5% | 4.5% |
A random two-character string from the gallery’s alphabet is valid about 7 times in 10. I would not read this as “the paper’s result is random”. OCR output is not random characters, and I did not model the twelve tries as independent draws, because they are not. The takeaway is narrower. When the output is one or two characters, Perl accepts most of it before any paint is involved. Past about ten characters the odds fall to a third or less, so a long valid reading would be the surprising result, and the gallery has only 7 of those.
What I did not check
- Version drift. Tesseract 5.3.4 against 4.0.0-beta.1 and Perl 5.38.2 against 5.26.1. The gap between 89 and 93 sits inside that uncertainty, and I did not try to close it.
- Image preprocessing. The paper does not say whether the images were resized, thresholded or cropped before OCR. I fed the files in as they are.
- The seven counterexamples. The gallery shows no text for them, so I cannot compare them. Two of those seven images give a valid reading in my runs, which only means my settings produce different strings than his.
- Compile, not run. Validity of OCR readings is
perl -c. I ran only the 93 published strings, not all 256 valid readings of mine. - The gallery’s strings are curated. The author says that when several settings gave valid Perl, he kept the one that seemed most “interesting.”2 That is part of why only 34 of 93 match my outputs verbatim.
- Tesseract flags. The whitelist is passed only to the legacy and combined engines, following the paper’s note that the LSTM engine did not honor one in 4.0. Whether 5.3.4 would honor it for LSTM I did not test.
Takeaways
- The 93% is a best-of-12 figure. The paper says so; the title does not.
- Rerunning the same grid gives 89 of 100, and the pure LSTM engine matches the paper’s 74 exactly. A single default Tesseract run gives 0.
- Most of the programs are one to three characters, and nothing in the set prints anything. Under
use strict, 21 of the 93 pass. - For short strings, validity is mostly a property of Perl’s grammar. A random two-character string from the same alphabet passes about 70% of the time.
- If you quote a number like this, quote the search procedure with it. “93% under the best of 12 settings” and “0% under defaults” describe the same experiment.
The scripts are the Perl-side check (standard library and perl) and the OCR rerun (standard library, tesseract and perl), with the output of my runs in the Perl check and the OCR rerun. The image set and gallery come from the author’s page.
Footnotes
-
93% of paint splatters are valid Perl programs (2019), Hacker News, submitted November 11, 2026 (572 points when I read it). ↩
-
Colin McMillen, 93% of Paint Splatters are Valid Perl Programs, with the gallery of strings and the image tarball. The page states that the source code is not available. The earlier submission count comes from searching the title on HN Algolia, which lists six submissions between April 2019 and November 2026. ↩ ↩2 ↩3
-
Colin McMillen and “Tim Toady”, 93% of Paint Splatters are Valid Perl Programs, SIGBOVIK 2019. Experimental Setup (Tesseract 4.0.0-beta.1, perl 5.26.1, 3 engines times modes 4, 7, 8 and 9, ASCII whitelist), Results (93 of 100, best single setting 55%, LSTM 74%, legacy 62%, combined 40%, non-empty only) and Discussion (barewords, programs that do nothing). ↩ ↩2 ↩3 ↩4
-
Tesseract documentation, Improving the quality of the output, for the list of page segmentation modes (3 is the default; 8 is “a single word”; 9 is “a single word in a circle”). I confirmed the same list with
tesseract --help-psmon 5.3.4. ↩ -
tesseract-ocr/tessdata, file
eng.traineddataat tag 4.1.0 (23,466,654 bytes, SHA-256daa0c97d...). The Ubuntu 24.04tesseract-ocr-engpackage contains only the LSTM model, so Tesseract exits with “legacy engine requested, but components are not present” for--oem 0. ↩ -
Perl documentation, strict.
use strict 'subs'generates a compile-time error for a bareword identifier that is not a subroutine. ↩