Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Building an anonymous subroutine

by oylee (Pilgrim)
on Aug 12, 2002 at 19:45 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://189602]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-24 12:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found