Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Creating dispatch table with variable in function name

by stevieb (Canon)
on Nov 21, 2017 at 19:43 UTC ( #1203943=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use warnings;
    use strict;
    ...
    sub create_first {
        print "first!\n";
    }
    
  2. or download this
    $VAR1 = {
              'first' => sub { "DUMMY" }
            };
    first!
    
  3. or download this
    $dispatch{_create_first}->();
    
  4. or download this
    use warnings;
    use strict;
    ...
    sub create_first {
        print "first!\n";
    }
    
  5. or download this
    $VAR1 = {
              'create_first' => sub { "DUMMY" }
            };
    first!
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2022-08-07 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?