this post was submitted on 28 Sep 2026
180 points (98.9% liked)

Programmer Humor

33370 readers
658 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 3 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] aMockTie@piefed.world 7 points 2 hours ago* (last edited 2 hours ago) (1 children)

Why waste time doing any matching if wantarray == false? Just do:

if(!wantarray) { return 1; }

Before any matching happens, or if you only want one return statement set the value of a variable in if(!wantarray)/elsif(regex) and return that variable at the end.

[โ€“] marcos@lemmy.world 5 points 2 hours ago

That Perl. You never know if return doesn't have some kind of hidden behavior that uses the local variables...

Well, you could read the perldoc page on it. But you can't just assume it.