Hacker News new | comments | show | ask | jobs | submit login
Black Perl (wikipedia.org)
330 points by diego on Sept 12, 2013 | hide | past | web | favorite | 67 comments

I wrote a (valid) Python poem a long time ago:

    import calendar as usual
    StandardError is usual \
    or not usual. month is long
    try: not coerce
    finally: quit
    (help for me in range
    (usual. MONDAY))

> import calendar as usual

so good

This C program not only reads as a series of letters, it also does something (slightly) interesting:


(HN discussion: https://news.ycombinator.com/item?id=375945)

Perl has always had a playful nature. For a surprisingly long time, my top rated post on Perlmonks was http://www.perlmonks.org/?node_id=29977. Since it is short, here it is in full:

The job I want:

    $dollars++ while sleep(1);
The job I get:


Perligata (https://metacpan.org/module/DCONWAY/Lingua-Romana-Perligata-...) always blew my mind. Write your programs in pure Latin.

Damien scares me a bit, despite that you could probably earn money making a teddybear looking like him and sell to kids. :-)

When he talks, you get the feeling it are thoughts that should not be thought; like going crazy from seeing Cthulhu.

He should scare you. He has one talk where he asks for volunteers from the audience to try to punch him. The ways that he proceeds to immobilize them relate to the various points he's making in his talk.

He's also the only person that I can think of who would seek to explain the concept of elementary particles being made of quarks using Mars bars as analogies. Right down to the fact that the sum of 3 of the masses of the small Mars bars slightly exceeds the mass of the large one - that right there is the binding energy!

For those who have not experienced him, Damian is hard to explain. For those who have experienced him, the full mind-bending reality is hard to remember. He's the only person about whom I say that if he's giving a presentation you go, just because it is Damian. Even if you don't know the topic. Even if you hate the topic. Even if you're bored by the topic. It is Damian. Go.

Perl is definitely for free thinkers.

And, sometimes, expensive doers.

>> It is Damian. Go.

Agreed, it is well worth the risk of sanity loss. :-)

Having had a chance to experience Larry up close at a YAPC, I firmly believe he's one of the most quirkily brilliant people in the industry (for whatever industry means in this case).

Perl was my first real programming language.

I was 12, I have a video game in Perl I wanted to modify (Frozen Bubble), I only knew shell. I did not have an Internet connection at home so I had to boy a book. So I bought Programming Perl 3rd edition, which had recently been released. And I read it. Front to back. Several times.

I probably wouldn't advise anybody to start programming by reading 1000+ pages of Larry Wall's prose. I do advise anybody serious about programming to read that book sometime. It is not only a book about a programming language. It is a book about the essence of software, or rather Larry Wall's vision of it, hidden behind a book about a programming language.

If I write code for a living today, it was in large part thanks to Larry Wall.

Is he still active? Haven't heard about him much in the mainstream tech media.

He came in June, or maybe late May, signed books, and talked/answered questions at my Advanced Perl class. He's friends with our teacher.

Was a real treat. A real nice humble guy. I posted in r/perl at the time. He's active in #perl6 on freenode, I believe.

It's a shame that he's had health issues.

He was there at YAPC::EU 2013 in Kiev.


Here's a little something in Python that I spent the last few hours writing:

  def unfalse_poem():
      (None is True) and False
      for subject in [complex(True,False)]:
          subject is not object
          for certainty in [complex(False,True)]:
              certainty is not Exception
              certainty is not license
              subject and certainty
              reduce and coerce
              coerce and reduce
              while certainty.real: unexamined
      for certainty in [complex(False,True)]:
          return certainty is not certainty.real is not certainty

It has a certain ring of Vogon poetry to it...

That's a very worthy philosophy.

How about a simple meta-sonnet game in Natural Inform?

From http://forums.penny-arcade.com/discussion/39142/inform-7-pro...:

    Will's Study is a room. The desk is here.
    A hastily handwritten note is on it.
    Description is "It's from your friend Shakespeare:
    'I've gone to lunch. You'll have to write the sonnet.'"
    Composing is an action applying to nothing.
    The quill is a thing that is in the study.
    Understand "write sonnet" as composing.
    Description of the quill is "Old and cruddy".
    Instead of composing when the player
    has no quill, say "You have not got the quill."
    Instead of composing, say "And... done. 'Heya',
    says Will, returning. You say, 'Hello, Will!'
    Says Shakespeare, 'Thank you for the time you've taken!
    You really are a pal, Sir Francis Bacon.'"

You have to say "is not carrying the" rather than "has no", to get it to compile.

It never occurred to me how perfect programming languages are for poetry. You have all these extra characters and whitespace to change how a piece of text feels or reads, and it becomes a visual experience too, like looking at art. Are there other program-poems people should look at?

The only thing I'd seen like this before was "Sunrise, Sunset" written in PHP. I know these things aren't new for many of you but I keep being surprised by the creativity I find.

So Larry Wall is a black metal artist in his spare time?

    kill them, dump qualms, shift moralities,
    values aside, each one;
    die sheep! die to reverse the system
    you accept (reject, respect);

Immortal's black metal classic "Call of the Wintermoon" makes much more sense translated to INTERCAL.

I wonder if that's the reason he initially didn't claim authorship, because it conflicts with him being a devout Christian?

Here's the original USENET post:


As a hard core atheist, it is good for me to see really religious guys like Larry Wall which are so laid back that they can make fun of their own opinions.

For the record, I have met a few.

A little bit like when, as an Emacs user, I see a post on a really informative blog about their Vi configuration. Or at a conference when the speaker connects the computer -- "wtf, he use Windows!?" :-)

(And as a metal fan I mostly avoid the lyrics, it might destroy the music if they are too stupid. But I'm a wimp which listen mostly to technical death.)

Completely offtopic, but there are some black(ish) metal bands with great lyrics.

Being a nerd, I am for example very partial to Vintersorg's album Cosmic Genesis (check out the song Algol ! [1]). (The singer, Andreas Hedlund, is actually a primary school teacher)

See (and hear) also the Irish band Primordial, who have great songs about Ireland. I've got goosebumps everytime I hear the chorus of "The Coffin Ships" [2] or the ending poem of "Death of the Gods" [3].

I could go on forever, but I'll mention three more bands, Vulture Industries for their very theatrical lyrics [4] and Solefald for the crazy and philosophical stuff [5]. And finally, a personal favorite of mine, Behemoth's "The Youth Manifesto" [6]. (Nergal, the lead singer and guitarist, is a fantastic lyricist and an incredible person)

[1] http://www.darklyrics.com/lyrics/vintersorg/cosmicgenesis.ht...

[2] http://www.darklyrics.com/lyrics/primordial/thegatheringwild...

[3] http://www.darklyrics.com/lyrics/primordial/redemptionatthep...

[4] http://www.darklyrics.com/lyrics/vultureindustries/thedystop...

[5] http://www.darklyrics.com/lyrics/solefald/neonism.html#3

[6] http://www.darklyrics.com/lyrics/behemoth/thelema666.html#11

To, sigh, go even more off topic.

I like my metal a bit less melodic. :-)

Meshuggah, Nile, Dillinger Escape Plan, etc. Not the extreme stuff (when Darkthrone's "Blaze in the northern sky" gave me a headache; then I knew I was at my limit :-) ).

Disclaimer: I do like lots of whining singer-songwriters and folk music (including Irish like Altan etc) too. Even Mary Gauthier!

Reminded of haikus written in Ruby: http://timelessrepo.com/haiku

My favorite poem is Sharon Hopkins' Listen https://groups.google.com/forum/m/#!topic/comp.lang.perl/V2R...

Can anyone explain what happens to all the undefined vars to someone unfamiliar with Perl?

Variables in perl are preceded by a sigil($,@,%,*). Those undefined words are not variables, but, at least in perl5, when you don't use strict, perl tries several fallbacks in order to find their value: see if it is a function (called without paranthesys), see if it is a constant, use it as a string otherwise.

They have the value "undef".

The Perl Poetry contest used to be a thing -- I don't think anyone ever measured up to "Black Perl" in awful audacity, but the parser can take a hell of a lot of abuse before it cries uncle.

Not literally a poem, a beautiful code written in Perl: http://www.perlmonks.org/?node_id=45213 (Camel Code)

Mandlebrot flythrough is my personal favorite: http://www.perlmonks.org/?node_id=329492

See the more recent Acme::EyeDrops : https://metacpan.org/module/Acme::EyeDrops

It seems like it would be trivial to arrange nearly any non-whitespace-significant language into arbitrary ASCII art.

The output of this code is also relevant — not just its source.

I want to run it, but do I have anything to fear? "Black Perl" suggests it's going to do some bad stuff to my box.

"perl -c" checks syntax without executing. (Try it and you'll see a lot of syntax errors using perl 5, so no chance of it executing -- but even if you run it under perl 3, you have nothing to fear.)

Careful with that. perl -c still runs the BEGIN blocks so don't rely on it for safety (ie. if you're handling untrusted code).

Haha, I don't think this script does much on a machine. It is designed to be interpreted by humans though.

I remember this -- I swear this was in one of the Perl books (the Camel book?) way back when.

It's valid Perl 3, but it is not supposed to do anything useful. The idea is simply to show how expressive you could be in the language.

It is in my edition of the camel.

Most of the discussion on Perl Poetry in the Camel Book is by way of inclusion of this Usenet post: https://groups.google.com/d/msg/news.groups/qSO-Q0rxg_E/RrRn...

I don't understand what you mean by 'expressive' in this sentence: if it's not to make the program do something specific, you could just wrap everything in a comment block and be as 'expressive' as you like in any language.

I elaborated on actual expressiveness here:


(which post starts by quoting the Black Perl to put you in the mood :)

No, the whole point is that this run on Perl 3. It's valid code.

Yeah, I get that it's valid Perl code, but it doesn't cause the computer to do something, or give an interesting output. A human can read it and find it interesting. I tried to say that in a witty way. Oh well...

Oh man, imagine a poem like this that outputted something relevant to the theme of the poem. That'd be amazing.

C'mon man, this is Perl. Easy things are easy, Hard things are possible.

In reverse:


omg, just ran that in perl. epic.

So what if it doesn't do anything?

The commenter isn't putting it down for that, just explaining he'd be surprised if it did anything let alone something mischievous.

It not doing anything isn't the point. The point is that it's technically valid code, but is still relevant to human interpretation.

It not doing anything matters - generally, code poetry is something that does do something interesting while being relevant to human interpretation; so code that simply validates syntactically isn't that amazing.

This was the point I was trying to make.

Well, he's answering @bmmayer1's question. It does not do anything, so it is safe to run on your computer.

Bob Howard will come and get you.


If "any sufficiently advanced technology is indistinguishable from magic" [Arthur C. Clarke] then incantation is really just programming through voice interface done smart.

That's pretty dark. :(

Am I the only one who thought this was about Pelé?

Now I have Margriet Eshuijs in my head.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact