Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: How can I call subroutines in an array

by eyepopslikeamosquito (Archbishop)
on Jun 10, 2003 at 08:17 UTC ( [id://264570]=note: print w/replies, xml ) Need Help??


in reply to How can I call subroutines in an array

Slightly different approach. Hey, variety is the spice of life!

use strict; use warnings; sub Handler::a1 { print("a1\n"); } sub Handler::a2 { print("a2\n"); } for (1..3) { exists($Handler::{'a'.$_}) ? &{$Handler::{'a'.$_}} : print "no handler for $_\n"; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2025-01-18 06:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (56 votes). Check out past polls.