Re: How to check if a function reference is valid or not?



On 11月28日, 下午8時36分, kra...@xxxxxxxxx (John W . Krahn) wrote:
On Wednesday 28 November 2007 04:14, Jeff Pang wrote:



for (keys %::) {
print "$_ -> $::{$_}\n" if /abc/;
}

__END__

the output is:
abcee -> *main::abcee
abc -> *main::abc

that's to say, when you say $f2 = \&abcee you have created an entry
in this script's symbol table.

Correct.

so, abcee can be anything (a hash, an
array, a scalar, a subroutine, a handler etc).

No, it is assigning a code reference so only the *main::abcee{CODE}
slot in the symbol table will be in use.

If you had said:

use vars '*abcee';

then abcee could be anything.

John
--
use Perl;
program
fulfillment

Thanks all

Howard

.



Relevant Pages

  • Closure code to assign image index to onload handler
    ... I'm writing some code that loads a number of images, ... standard mechanism of assigning a src url to a newly constructed Image ... thus invoking the image-load operation. ... an image.onload handler I've previously assigned will be called. ...
    (comp.lang.javascript)
  • Re: Closure code to assign image index to onload handler
    ... standard mechanism of assigning a src url to a newly constructed Image ... On a successful load, ... an image.onload handler I've previously assigned will be called. ...   but remember, you're not passing the value of the variable here, ...
    (comp.lang.javascript)
  • Re: Trapping an invalid email error in Excel VBA code
    ... errors aren't sent to your handler. ... Sub ErrorHandledLoop ... > returned and the macro halts. ... > accordingly and the subroutine then carries on looping. ...
    (microsoft.public.excel.programming)
  • Re: Closure code to assign image index to onload handler
    ... standard mechanism of assigning a src url to a newly constructed Image ... On a successful load, ... an image.onload handler I've previously assigned will be called. ...   but remember, you're not passing the value of the variable here, ...
    (comp.lang.javascript)
  • Re: Closure code to assign image index to onload handler
    ... standard mechanism of assigning a src url to a newly constructed Image ... On a successful load, ... an image.onload handler I've previously assigned will be called. ...   but remember, you're not passing the value of the variable here, ...
    (comp.lang.javascript)