Perl has lots of ways to write something such that you don't know at a glance what it's supposed to do
Well… Perl programmers do. It's weird… it's like this site is almost dedicated to those people. Maybe a name change would help combat the lack of clarity perptually befuddling you. s/Perl Monks/Perl Programmers Who *Like* Perl and Also Enjoy Learning, Exploring Problems, and Helping Their Community; Unemployable PMs Are Welcome to Participate Providing They Remain Respectful and Don't Become Founts of Acrimony or Wasted Time for Years on End/g; | [reply] [Watch: Dir/Any] [d/l] |
Anonymous monk, and that is precisely where that is being placed, inside of a one liner utility subroutine, that is documented as to what it tests, in this case, it returns 1, true, if the match is correct, and undefined, false, if not. As part of a larger test, but as a one liner. I have used arcane syntax like this internally in utility tools, and try to keep it out of the main logic that would be likely to get patches or pull requests. Documented, with comments, etc.
Now that this is confirmed safe, I'll be extending its use for all numeric tests (which is what this particular case is doing), and look into more secret type constructions for various utilities, that are not meant to be end user readable or serviceable, but are meant to be very very fast.
| [reply] [Watch: Dir/Any] |
Note that the content of the "anonymous" reply you replied to indicates it was authored by our Worst Nodes champion - who's
recently introduced an annoying new tactic of replying "anonymously" ... and then sometimes agreeing with himself by replying
to the "anonymous" post as sundialsvc4!
I don't know why he's started doing this only recently.
FWIW, I've often used the goatse operator in production code at work without wrapping it in a sub -
though I always provide a one-line comment pointing to the goatse operator documentation.
Having discussed the use of this operator during code reviews with a number of serious C++ programmers (but occasional Perl programmers) at work,
I can report they've all been happy with this approach because, as skilled programmers,
once they became aware it's a standard Perl idiom, they found the perlsecret documentation
clear and easy to understand.
| [reply] [Watch: Dir/Any] |
In my case, I do want this wrapped up and safely out of view, because the potential contributors would be confused by such syntax, plus I do actually want it used as a utility subroutine to avoid scattering this type of stuff around the program, specifically to be able to update/tweak/optimize these tools as I go along. But thanks for the heads-up.
| [reply] [Watch: Dir/Any] |
"and tells everyone else exactly what it's supposed to do?" It does. You big dummy. | [reply] [Watch: Dir/Any] |