in reply to Re^2: Function reference undef when extract from hash?
in thread Function reference undef when extract from hash?
why the code fail in this case?
The only possibly reason is if build_sth('set_to_flag') is called before my %Op = ( ... ); is executed.
Otherwise, it doesn't fail.
sub write_flag { print "write_flag\n"; } sub set_tree { print "set_tree\n"; } sub do_nothing { print "do_nothing\n"; } ... code you provided ... build_sth('set_to_flag'); # Prints write_flag
|
|---|