I see your question has been answered directly by a few other fine Monks, but I thought I might add something. If you'd like to get a coderef without using eval, you can use can. For example:
sub foo { print "Foo!\n"; } my $pkg = "main"; my $sub = "foo"; my $cr = $pkg->can($sub) or die "Can't find '$sub' in package '$pkg'\n"; $cr->();
In reply to Re: How to convert a symbolic reference to a hard reference
by revdiablo
in thread How to convert a symbolic reference to a hard reference
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |