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.
Perl is write-only code. Larry Wall raised a monkey’s paw and asked for a language that works the way programmers want. So most Perl is the first thing someone tried, unfiltered by rigid syntax putting your thoughts in order, compiler warnings bringing side effects to mind, or even names forcing you to decide what a variable is. An uncommented Perl script is raw brain patterns displayed as ASCII.
Thank god it runs like crap. We’d be in so much trouble if it was fast. Optimized C isn’t exactly gorgeous, but any project that compiles proves someone looked at the code more than once.
I love the term “write-only code”, it’s perfect. I used to love Perl as it felt like it flowed straight from my brain into the keyboard. What a free and magical language.
So it turned out I had ADHD. Took meds, went back to C/++ with renewed appreciation, haven’t touched Perl since as it horrifies me to look at it. What a nightmare of dangling references and questionable typing. Any language that allows you to cast a string to a function and call it really needs to sit down and think about what it’s doing.
No such thing as eval in non-interpreted languages. Unless you’re crazy enough to invoke the compiler and exec() the result.
I used eval too in my Perl days which is why I specifically called it out. IMO any time you see eval used there should be another, more proper way to do it.
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
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
Posts must be relevant to programming, programmers, or computer science.
No NSFW content.
Jokes must be in good taste. No hate speech, bigotry, etc.
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.
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 theglob
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.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.
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”);
}
Perl is write-only code. Larry Wall raised a monkey’s paw and asked for a language that works the way programmers want. So most Perl is the first thing someone tried, unfiltered by rigid syntax putting your thoughts in order, compiler warnings bringing side effects to mind, or even names forcing you to decide what a variable is. An uncommented Perl script is raw brain patterns displayed as ASCII.
Thank god it runs like crap. We’d be in so much trouble if it was fast. Optimized C isn’t exactly gorgeous, but any project that compiles proves someone looked at the code more than once.
I love the term “write-only code”, it’s perfect. I used to love Perl as it felt like it flowed straight from my brain into the keyboard. What a free and magical language.
So it turned out I had ADHD. Took meds, went back to C/++ with renewed appreciation, haven’t touched Perl since as it horrifies me to look at it. What a nightmare of dangling references and questionable typing. Any language that allows you to cast a string to a function and call it really needs to sit down and think about what it’s doing.
I believe
eval
would like a word with you…As I said,
No such thing as eval in non-interpreted languages. Unless you’re crazy enough to invoke the compiler and exec() the result.
I used eval too in my Perl days which is why I specifically called it out. IMO any time you see eval used there should be another, more proper way to do it.
I was joking, and definitely agree with you. I don’t think I’ve used
eval
since my first programming course in uni.Edit: Except for monkey hacks for laughs of course.
Genuine LOL. Yeah… yeah, that’s Perl in a nutshell. Creating Perl: ‘why aren’t all languages like this?!’ Editing Perl: ‘oh.’
Be honest: you just mashed your fist on the keyboard, didn’t you?
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
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.
Perl is fine, provided that you never have to touch someone elses code.
Or yours
No. My code is perfect. It’s all of the others who write bullshit.