<?xml version="1.0" encoding="windows-1252"?>
<node id="459244" title="Re: Switch.pm or possible alternatives" created="2005-05-21 10:28:19" updated="2005-08-11 07:44:13">
<type id="11">
note</type>
<author id="87452">
broquaint</author>
<data>
<field name="doctext">
What marvellous timing as I can point you to my new module, &lt;tt&gt;[cpan://Switch::Perlish]&lt;/tt&gt; (which should be available on CPAN any moment now if it isn't already). So extrapolating from your node this code should do the job:

&lt;code&gt;
use Switch::Perlish;

switch $your_var, sub {
  case 'this',  \&amp;this_function;
  case 'that',  \&amp;that_function;
  case 'the',   \&amp;the_function;
  case 'other', \&amp;other_function;
  default
    sub { print "Nothing matched '$your_var'\n" };
};
&lt;/code&gt;

&lt;div class="pmsig"&gt;&lt;div class="pmsig-87452"&gt;
HTH
&lt;p/&gt;
&lt;tt&gt;_________&lt;br&gt;&lt;u&gt;broquaint&lt;/u&gt;&lt;/tt&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
458948</field>
<field name="parent_node">
458948</field>
</data>
</node>
