Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Oh ye who hold all Perl wisdom!
My Perl foo is sufficient to understand the following:
#!/bin/env perl use strict; use warnings; my $coderef = \&f; print &$coderef, $/; sub f { return 1; }
...which simply outputs upon execution:
1
Yet, what I would really like is to map a string to the code reference of the function itself -- something similar to the following (syntax is incorrect...):
my $s = 'f'; print $s(), $/;
...which would give similar output as the preceding code.
Those that bear all ye knowledge, what is the syntactic incantation?
Thanks!
Back to
Seekers of Perl Wisdom