in reply to Re^2: Aren't there code refs as well as function refs?
in thread Aren't there code refs as well as function refs?

I avoid prototypes in my code, except for the empty prototype '()' to create "Constant Functions".

In v5.36.0, the experimental status of subroutine Signatures was removed. You may find this to be a better method to declare parameters. Do note that prototypes and signatures are not different syntaxes for the same thing: follow the link for details. This is something I do like and have been using in all of my personal code since Perl v5.36.0 was released.

Not that I'm recommending it but, just so you know, you can use both a prototype and a signature with the same subroutine. If you do this, use of the :prototype() attribute is advised to avoid ambiguity.

— Ken

Replies are listed 'Best First'.
Re^4: Aren't there code refs as well as function refs?
by Bod (Parson) on Mar 04, 2023 at 12:07 UTC
    I avoid prototypes in my code, except for the empty

    Likewise...

    When I first came across prototypes in Perl they sounded extremely useful. However, I have come to realise that they are never really necessary at all - or if they are, I have not come across the use case. The complications they add to understanding and maintaining the code is not worth the tradeoff.