in reply to Coderef from scalar.
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Coderef from scalar.
by vaevictus (Pilgrim) on Dec 29, 2001 at 05:11 UTC |