Hi,

I'm wondering why Perl doesn't complain about the following code:

----------
#!/usr/bin/perl -w
use strict;

my $funcRef = \&otherDummyFunc;
my $oneVar = &callTheReferredFunc();
print $oneVar;

sub dummyFunc {
    return 42;
}

sub otherDummyFunc {
    return "your mom";
}

sub callTheReferredFunc {
    my $returnVal = &$funcRef;
    return $returnVal;
}
----------

Output: your mom

I don't pass $funcRef to &callTheReferredFunc, and yet "-w" doesn't
generate a warning for an undefined reference.  Are function
references somehow global in nature?  This doesn't seem to be true of,
say, variable references.

I'm clearly missing something.  Explanations would be helpful ...

Thanks,
Daniel


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to