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]
Re: "my", "strict", and function references
Jeff 'japhy/Marillion' Pinyan Sat, 28 Jul 2001 19:08:38 -0700
- Re: $_ question Michael Fowler
- Re: $_ question Jos I. Boumans
- Script for Sheduling j... Ackim Chisha
- Re: Script for She... SunDog
- Re: Script for She... M. Buchanan
- Re: Script for She... Steven Yarbrough
- RE: Script for She... Steve Howard
- Re: Script for She... Walt Mankowski
- "my", &q... Dan Grossman
- Re: "my"... Walt Mankowski
- Re: "my"... Jeff 'japhy/Marillion' Pinyan
- Re: "my"... Dan Grossman
- RE: $_ question Wagner-David
- RE: $_ question Jeff 'japhy/Marillion' Pinyan
- RE: $_ question Wagner-David
