At 02:40 PM 4/8/2005, Charles K. Clarkson wrote:
John Deighan <> wrote:

[snip]
: However, I can't get this warning to appear. Is it that
: 'reset' isn't a 'keyword'?
[snip]

     No. You just gave up too quickly.

#!/usr/bin/perl

use strict;
use warnings;
use diagnostics;

sub reset;

print reset();

sub reset {
    return "resetting...\n";
}

Thanks for the tip. However, it turns out to have nothing to do with "use diagnostics". The warning appears (when compiling as well as executing, which is great), if and only if the subroutine is declared or defined before being called. Compare the following 3 programs:


1. This one generates no warnings, either at compile or run time:

use strict;
use warnings;

reset();
print("OK\n");

sub reset { print("resetting...\n"); }

2. This one generates the "ambiguous call" warning AND a prototype mismatch warning:

use strict;
use warnings;

sub reset();

reset();
print("OK\n");

sub reset { print("resetting...\n"); }

3. This one generates just the "ambiguous call" warning:

use strict;
use warnings;

sub reset { print("resetting...\n"); }

reset();
print("OK\n");


Everyone - thanks for all your help and interesting discussion.

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to