this post was submitted on 12 Mar 2024
1093 points (95.7% liked)

Programmer Humor

32710 readers
696 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

Please dont take this seriously guys its just a dumb meme I haven't written a single line of code in half of these languages

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 90 points 10 months ago* (last edited 10 months ago) (5 children)

Perl:

Problem -> $ @ % <=> <> =()= => ; qw() ])} select(undef, undef, undef, 0.25) =~ tr/.?\w\sREg3xfr0mhe|l/foo/g; $|++ &homebrewedFunction(%$ref, $_ , @_ ) -> solution

Source: I mainly code in perl. I like it, but I'll be the first to admit that it's not a beautiful language.

I was about to make an entry for lisp here, but I don't have enough parentheses to draw the path to the solution.

[–] [email protected] 36 points 10 months ago* (last edited 10 months ago)

https://www.foo.be/docs/tpj/issues/vol4_4/tpj0404-0015.html

The Perl Poetry Contest - The Perl Journal, Winter 1999

#!/usr/bin/perl
#
# asylum.pl
# by Harl

close (youreyes);
bind (yourself, fast);

while ($narcosis) {
   exists $to($calm);
   not calm;
}

accept the, anesthesia;
seek the, $granted, $asylum'
and wait;

stat ically;

unlink and listen (in, $complicity);

for (a, little) {
   system ("sync hronicity");
}

[–] [email protected] 11 points 10 months ago* (last edited 10 months ago) (1 children)

Over the top tone: "Pretty sure that won't compile. $EVAL_ERROR modulo what you get from the filehandle called = isn't an lvalue that can be put through the Goatse operator that I'm aware of."

But seriously(?), I'm almost certain that's not how that would be parsed. = isn't a valid bareword, so Perl would choke on the spaceship operator not being a term... I think.

After testing... It's worse. I think it's parsing <> as the glob operator and = as a filespec.

For those who don't know Perl:

Because of its appearance, <=> really is called the spaceship operator (at least, when it can be parsed as an operator and not whatever happened above).

=()= by comparison has unofficially been called Goatse. If you don't know what Goatse is, find out at your own risk. If you do know, you can see why this particular pseudo-operator was given that name.

And if you're still reading, =()= is a pseudo-operator because it's not actually parsed as part of the syntax. It's literally an assignment operator = followed by an empty list () followed by another assignment operator =, providing list context to the outside of the equals signs that wouldn't otherwise be there.

[Why are you still still reading?] Context is important in Perl. If a function returns a list of values (which is something Perl functions can do) and you try to store the result in a scalar variable, replacing the usual = with =()= will store the number of elements returned rather than the last element of the list.

[–] [email protected] 8 points 10 months ago* (last edited 10 months ago)

It's not supposed to be compilable. It's more intended as a list of weird looking (but valid and useful) perl stuff.

As for the goatse operator, I've mostly used it for counting amount of regex matches.

Oh, and I forgot the diamond operator. Added.

[–] [email protected] 9 points 10 months ago (1 children)

I was hired twice to write Perl, both times switched my department to something else after a few years.

Perl is good for command line processing, and absolutely god awful read-only magic hacks. Nothing else.

[–] [email protected] 13 points 10 months ago (1 children)

Perl is fine, provided that you never have to touch someone elses code.

[–] marcos 9 points 10 months ago (1 children)
[–] [email protected] 3 points 10 months ago

No. My code is perfect. It's all of the others who write bullshit.

  • Every perl dev ever
[–] grue 8 points 10 months ago

Be honest: you just mashed your fist on the keyboard, didn't you?

[–] [email protected] 3 points 10 months ago

I personally never understood how anyone could find Perl appealing or even "good" to program in, probably because I could never understand wtf the code was meant to do