Contrary to the above two answers, you don't need eval to build a code ref. Just an anonymous sub will do it:
More can be found in perlman:perlref. Look at the section titled "Making references".my $code = sub { print "hello perlmonks\n"; }; # &specialfunction($code);
HTH
In reply to Re: Coderef from scalar.
by VSarkiss
in thread Coderef from scalar.
by vaevictus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |