Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Implementing Dispatch Tables

by deMize (Monk)
on Jul 31, 2012 at 13:41 UTC ( #984599=note: print w/replies, xml ) Need Help??


in reply to Implementing Dispatch Tables

This is an old post, but regarding your snippet ($disp_table{'not there'} || sub {})->(); why not do something like $disp_table{$some_key}->() if $some_key;?

It shouldn't error out for using an empty string. If your key is falsy (0 or undef), then it won't look it up.



Demize

Replies are listed 'Best First'.
Re^2: Implementing Dispatch Tables
by jdporter (Canon) on Jul 31, 2012 at 13:44 UTC

    TIAS

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://984599]
help
Chatterbox?
[choroba]: Rama!
[shmem]: hm. That should be "an artist's expression"
[RonW]: Happy Thanksgiving Eve
[RonW]: and no panic, here. We're staying home, safe from the frenzy in the stores

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2017-11-22 16:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (327 votes). Check out past polls.

    Notices?