Why not just create the subroutine reference like this:
my $code = sub { my $dfv = shift; my $var = shift; return $var !~ /\d+/ ? 1 : 0; }; my $profile = { required => [qw/my_name/], constraint_methods => { my_name => $code, }, };
No need to create a string first.
In reply to Re: Dynamically Creating a Code reference
by badaiaqrandista
in thread Dynamically Creating a Code reference
by Herkum
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |