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

Re: Building an anonymous subroutine

by oylee (Pilgrim)
on Aug 12, 2002 at 19:45 UTC ( #189602=note: print w/replies, xml ) Need Help??


in reply to Building an anonymous subroutine

Perhaps a hash of subs would be useful to lift out the conditional tests also, e.g.,
sub template { my $e = shift; my %actionhandlers = ( p => sub {...blougat...}, b => sub {...blimblim...}, u => sub {...hoohaa...} ... ); return sub { ... common stuff ... $actionhandlers{$e}->(...args_if_any...); ... more stuff ... }; }

Anonymous Lee

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://189602]
help
Chatterbox?
[oiskuu]: Someone needs to re-read How do I use the power of consideration responsibly? carefully. Consideration is not intended for stamping out humor, AFAIK.
[oiskuu]: E.g. Re^3: Big thank you to the Perl community. is surely dry humor (not mine). Don't they teach humor in german schools!?

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2017-04-27 19:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (512 votes). Check out past polls.