vaevictus has asked for the wisdom of the Perl Monks concerning the following question:
my $code='{ print "hello, perlmonks\n"; }'; sub samething { print "hello, perlmonks\n"; } &specialfunction( \&samething ); #normal &specialfunction( { print "hello, perlmonks\n"; } ); #also valid &specialfunction( $code ); #not a coderef!
How do i make this last line work?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(Ovid) Re: Coderef from scalar.
by Ovid (Cardinal) on Dec 29, 2001 at 05:01 UTC | |
by vaevictus (Pilgrim) on Dec 29, 2001 at 05:10 UTC | |
by Ovid (Cardinal) on Dec 29, 2001 at 05:16 UTC | |
by vaevictus (Pilgrim) on Dec 29, 2001 at 05:32 UTC | |
by Fastolfe (Vicar) on Dec 29, 2001 at 09:49 UTC | |
|
Re: Coderef from scalar.
by larryk (Friar) on Dec 29, 2001 at 04:55 UTC | |
by vaevictus (Pilgrim) on Dec 29, 2001 at 05:15 UTC | |
|
Re: Coderef from scalar.
by VSarkiss (Monsignor) on Dec 29, 2001 at 05:04 UTC | |
by vaevictus (Pilgrim) on Dec 29, 2001 at 05:11 UTC | |
|
Re: Coderef from scalar.
by Juerd (Abbot) on Dec 29, 2001 at 04:58 UTC |