Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

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."

Comment on Re: Strict, strings and subroutines
Select or Download Code

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 chilling in the Monastery: (3)
As of 2015-11-27 07:04 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 (719 votes), past polls