in reply to MOPT-04 - identification, part 2
I have a correction to your first part of a message
Perl's function bindings are statically scoped, not dynamically scoped, so we can't bind the name to a new entity in a different evaluation context. If we want to play with dynamically scoped entities in Perl, we have to stick to local variables.
Perl's function bindings are statically scoped, not dynamically scoped, so we can't bind the name to a new entity in a different evaluation context. If we want to play with dynamically scoped entities in Perl, we have to stick to local variables.
Actually you can redefine subroutine by using eval "sub func {'...'}" and better yet is just to use anonymous subroutines and use ordinary variables to switch between different ones:
my $func = sub { return "value"; }; $func->(); $func = sub { return "another value"; }; $func->();
Courage, the Cowardly Dog
|
---|
Replies are listed 'Best First'. | |
---|---|
Re2: MOPT-04 - identification, part 2
by mstone (Deacon) on Jan 08, 2003 at 01:52 UTC |
In Section
Meditations