Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

When should I use a dispatch table?

by Limbic~Region (Chancellor)
on Nov 30, 2006 at 23:00 UTC ( [id://587072]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    if    ($item eq 'thing1') { # ... }
    elsif ($item eq 'thing2') { # ... }
    elsif ($item eq 'thing3') { # ... }
    elsif ($item eq 'thing4') { # ... }
    else                      { # ... }
    
  2. or download this
    #!/usr/bin/perl
    use strict;
    ...
        $opt->{t} = $opt->{n} * 10 if ! defined $opt->{t};
        $opt->{u} = 0              if ! defined $opt->{u};
    }
    
  3. or download this
    #!/usr/bin/perl
    use strict;
    ...
            }
        },
    });
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://587072]
Approved by imp
Front-paged by liverpole
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-25 18:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found