Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Strict, strings and subroutines

by davorg (Chancellor)
on Oct 10, 2001 at 16:18 UTC ( #117978=note: print w/replies, xml ) Need Help??

in reply to Strict, strings and subroutines

I'd do this by creating a hash of references to the various subroutines like this:

sub do_x { print "processing x\n"; } sub do_y { print "processing y\n"; } my %subs = ( x => \&do_x, y => \&do_y );

Then when you know what type you're going to be processing, you can do something like this:


"The first rule of Perl club is you don't talk about Perl club."

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (13)
As of 2016-10-28 14:57 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (385 votes). Check out past polls.