Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: sub Prototype Syntax

by eyepopslikeamosquito (Chancellor)
on Apr 07, 2012 at 04:59 UTC ( #963885=note: print w/replies, xml ) Need Help??

in reply to sub Prototype Syntax

First, the code you posted has a syntax error in that you are missing a semi-colon after the first line below:

$template_string = $_[0] %internal = %{$_[1]};
There are also some stylistic oddities, such as using ALL CAPS for function names, calling the function with a leading &, and using prototypes (see next para), that caused me to pull a face -- though not errors they show dubious style IMHO.

Second, you probably shouldn't be using prototypes at all. For why not see:

This new 5.12 warning that you experienced is described in perl 5.12 perldelta (search for "prototype after"). It seems you can silence this warning by adding the line:

no warnings 'illegalproto';
after your "use warnings" line (I am assuming you are using strict and warnings). However, I doubt that blindly silencing this warning is a good idea because it is telling you that the prototype is invalid -- presumably because of the optional arguments after the '%' character (I don't use prototypes so I'm not certain of that). See perlsub for Perl prototype documentation. You can also make it go away by simply removing the prototype (recommended) or shortening it to just:

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://963885]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2018-03-19 05:22 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (232 votes). Check out past polls.