Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Implementing Dispatch Tables

by Roy Johnson (Monsignor)
on May 12, 2005 at 19:27 UTC ( #456530=perltutorial: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my %disp_table = ( something => \&do_something );
    
  2. or download this
    $disp_table{'something'}->();
    
  3. or download this
    ($disp_table{'not there'} || sub {})->();
    
  4. or download this
        one   => sub { print "Number!\n" },
        two   => sub { print "Number!\n" },
        three => sub { print "Number!\n" },
    
  5. or download this
        one   => sub { print "The loneliest "; number() },
        two   => \&number,
        three => \&number,
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2023-03-31 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (75 votes). Check out past polls.

    Notices?