this post was submitted on 28 Aug 2025
174 points (93.1% liked)

Programmer Humor

26799 readers
1524 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] palordrolap@fedia.io 5 points 1 month ago

Perl time:

sub AUTOLOAD {
    our $AUTOLOAD=~s/.*:://;
    no strict;
    local $_=$_[0] and *STDOUT->$_($AUTOLOAD)
}

HelloWorld("print");

Pro: You can Give HelloWorld any (syntactically valid) name you like and (as long as the parameter is "print", anyway) its name will be printed, no pre-declaration required.

Con: The specified function inside the quotes has to be a method associated with a file descriptor.