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

Re: [PBML] case/switch?

Expand Messages
  • Andrew Johnson
    ! Is there a case or switch statement in Perl as there is in C, Java, ! et al? The short answer #1: No Perl does not have a switch/case statement -- but it
    Message 1 of 4 , Sep 27, 2000
    • 0 Attachment
      ! Is there a case or switch statement in Perl as there is in C, Java,
      ! et al?

      The short answer #1: No

      Perl does not have a switch/case statement -- but it does have
      several ways of accomplishing the same thing (or slightly
      different things):

      See the perlsyn manpage and the section entitled:
      Basic BLOCKs and Switch Statements

      Also see perlfaq7 for the heading:
      How do I create a switch or case statement?

      The short answer #2: Yes

      Perl can now have an explicit switch statement provided via a module
      (Switch.pm) by Damian Conway -- this is really a switch on steroids:
      simple syntax, rich semantics. You can grab Switch.pm from your
      nearest CPAN site.

      regards,
      andrew


      --
      Andrew L. Johnson http://members.home.net/perl-epwp/
      A closed mouth gathers no foot.
    Your message has been successfully submitted and would be delivered to recipients shortly.