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

  • 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: return false not preventing href action
    ... > I've read that one must return false from an onclick handler ... It is assigning an event listener to the element using the W3C ... Though using an inner function may not be the best idea. ...
    (comp.lang.javascript)
  • Event handlers...
    ... I just know I'm doing something wrong, because assigning an event ... cancelQry is a TDataset which is being acted upon elsewhere. ... (Since I can't pass in parameters, and I want this handler to ... putting it in the same unit, but still got the error message. ...
    (comp.lang.pascal.delphi.misc)
  • Re: Newbie Question - ArrayLists and methods
    ... If you must use a mutable type, have the subroutine make a defensive copy of the argument and work on that instead. ... in reality this defeats several OO principals. ... If you think of the method call as a message, then that message handler should be free to issue other messages to any objects that it knows about. ... A good design might include making a defensive copy so that the handler method won't do something it's not supposed to do. ...
    (comp.lang.java.programmer)
  • Re: Salford dumps fortran , FTN95 goes to silverfrost
    ... > Did you try assigning a value to the result variable above ... END SUBROUTINE ... Other incorrect errors seem to be harder to testcase. ... Joost ...
    (comp.lang.fortran)