On Jul 28, Dan Grossman said:

>#!/usr/bin/perl -w
>use strict;
>
>my $funcRef = \&otherDummyFunc;
>
>sub callTheReferredFunc {
>    my $returnVal = &$funcRef;
>    return $returnVal;
>}

>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.

You're confusing something here, and I can't tell what it is.  The
variable $funcRef is NOT global -- it is lexically scoped (because you
used my() on it).  It is not visible OUTSIDE the scope that you declared
it in -- but it IS visible inside smaller scopes, like the one of the
callTheReferredFunc() function.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
http://www.perlmonks.com/                          http://search.cpan.org/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl regex book      **


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

Reply via email to