in reply to Can't Reference a Sub by Variable when using Strict
Oops. Should have read the code a little more closely...
keys returns list of keys to the hash. your code is in the value of the hash
In light of tachyon's comment, here's what I *would have* done
my %lists = ( 'coderef_name1' => \&coderef1, 'coderef_name2' => \&coderef2 ); while (my($key, $code) = each %lists) { print "executing $key: "; $code->(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can't Reference a Sub by Variable when using Strict
by tachyon (Chancellor) on Oct 04, 2004 at 02:11 UTC |