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

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

Comment on Re: Building an anonymous subroutine
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://189602]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2015-11-29 18:35 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (752 votes), past polls