Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Dynamic Subroutines?

by Malkavian (Friar)
on Mar 30, 2001 at 20:15 UTC ( #68416=note: print w/replies, xml ) Need Help??


in reply to Dynamic Subroutines?

I think you're looking for anonymous subroutines.
A quick example:
# Compile some anonymous subroutine code in a variable my $code='sub { print "A quick sample\n";}'; # Turn this into a reference to some executable code my $subroutine=eval $code; # Invoke the subroutine you just made &$subroutine();

This is just a quick example, hope it helps.

Malk

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://68416]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2020-04-07 18:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The most amusing oxymoron is:
















    Results (43 votes). Check out past polls.

    Notices?