[Wellington-pm] Gratuitous use of Perl Prototypes

Enkidu enkidu at cliffp.com
Tue Nov 9 03:25:41 CST 2004


On Tue, 09 Nov 2004 11:06:27 +1300, you wrote:

>Following on from my comments last night, I present the case against
>inappropriate use of Perl prototypes.
>
(Sorry about the removal of all the good stuff)

What about the following bit of horrible code?

#!/usr/bin/perl -w

my $var1 ;
my $var2 ;
sub blimey() ;

$var1 = "0" ;
blimey() ;

sub blimey() {
}

If you remove the "sub blimey() ;" line the compiler complains:

main::blimey() called too early to check prototype at test.pl line 7.

What's the reason and what can you do about it, short of putting all
the subs at the front of the code which looks horrible and makes it
hard to read!

Cheers,

Cliff



More information about the Wellington-pm mailing list