Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: alternatives to if and series of elsif

by Xaositect (Friar)
on Jul 01, 2005 at 17:09 UTC ( #471775=note: print w/replies, xml ) Need Help??

in reply to alternatives to if and series of elsif

This may not be relevant to your specific example since you're making two comparisons for each conditional, but there is a perl switch statement on CPAN. More than one actually.

Xaositect -
  • Comment on Re: alternatives to if and series of elsif

Replies are listed 'Best First'.
Re^2: alternatives to if and series of elsif
by Forsaken (Friar) on Jul 01, 2005 at 20:33 UTC
    And as has been discussed quite often here in the Monastery, actually using is a rather bad idea, as it attempts to parse Perl code and tends to fail in all sorts of unexpected and nasty ways. Switch::Perlish looks nice, but has to jump through a lot of loops in order to emulate switch as we know it from ie C, resulting in what looks like a negligible, if none at all, gain over a regular if/elseif/else construction. From personal experience I'd say either go for the fullblown if/elseif/else construction or, like in this case, use map or a hash.

    Remember rule one...

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2020-10-23 00:47 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (234 votes). Check out past polls.