Adam has asked for the wisdom of the Perl Monks concerning the following question:
use strict; sub test { print 'hello world!' }; my %hash; $hash{test} = \&test; # This generates an error: &$hash{test}; # Global symbol "$hash" requires explicit package name at script.pl li +ne 7. # syntax error at script.pl line 7, near "$hash{test" # Execution of script.pl aborted due to compilation errors. # But this works: &{$hash{test}}; # why???
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: hash o' refs
by merlyn (Sage) on Aug 08, 2000 at 02:42 UTC | |
by Russ (Deacon) on Aug 08, 2000 at 03:12 UTC | |
by Adam (Vicar) on Aug 08, 2000 at 02:44 UTC | |
|
RE: hash o' refs
by mwp (Hermit) on Aug 08, 2000 at 02:48 UTC | |
|
Re: hash o' refs
by tilly (Archbishop) on Aug 08, 2000 at 02:46 UTC | |
|
RE: hash o' refs
by Anonymous Monk on Aug 08, 2000 at 18:42 UTC | |
by merlyn (Sage) on Aug 08, 2000 at 19:34 UTC |