in reply to Dynamically Creating a Code reference
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.
|
|---|