Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Problem with Switch

Expand Messages
  • Shlomi Fish
    Hi Jim, ... Please don t use Switch.pm : http://perl.net.au/wiki/Freenode_Sharp_Perl_FAQ#How_can_I_do_a_switch_statement_in_Perl.3F It s a source filter which
    Message 1 of 3 , Feb 11, 2011
      Hi Jim,

      On Friday 11 Feb 2011 05:38:19 ohaya wrote:
      > Hi,
      > I am really new (or, actually, it's been awhile) with Perl, and am having
      > problems getting a 'switch' working with Perl 5.8.8.

      Please don't use Switch.pm :


      It's a source filter which causes many problems, and we won't be able to help
      you further if it is still used.

      Some of the alternatives are:

      1. given/when in perl-5.10.x and above (not suitable if you still want
      compatibility for perl-5.8.x and below).

      2. Sometimes dispatch tables (implemented using hashes pointing to subroutine
      references) or iterating over an array of key/value pairs until one of them
      matches will do the trick.

      3. There are also if/elsif/else chains which are not that bad.


      Shlomi Fish

      Shlomi Fish http://www.shlomifish.org/
      Stop Using MSIE - http://www.shlomifish.org/no-ie/

      Chuck Norris can make the statement "This statement is false" a true one.

      Please reply to list if it's a mailing list post - http://shlom.in/reply .
    Your message has been successfully submitted and would be delivered to recipients shortly.