Strange perl syntax ( $$ ) in sub routine

perl

Solution

That's a function prototype, which is used to specify the number and types of arguments that the subroutine takes. See the documentation.

Since it's in the current documentation, I don't see why it's preventing you from upgrading.

Is the error you're getting `help called too early to check prototype`? Here's the explanation from the perldiag documentation:

(W prototype) You've called a function that has a prototype before the parser saw a definition or declaration for it, and Perl could not check that the call conforms to the prototype. You need to either add an early prototype declaration for the subroutine in question, or move the subroutine definition ahead of the call to get proper prototype checking. Alternatively, if you are certain that you're calling the function correctly, you may put an ampersand before the name to avoid the warning. See perlsub.

Problem

What dose the `( $$ )` do in this code. I have programmed Perl for a long time but never came across this syntax until recently when I opened a very old Perl .plx file These rows prevent me from upgrading to a more modern Perl version. ``` sub help( $$ ){ } ``` The reason it affects me is because I get an error message stating that the help function was called before it was declared. Any idea of how I can solve this without removing the ( $$ ) block??

Original source

Related problems