On Monday 22 April 2002 12:07 pm, Marc te Vruchte wrote:
> Well, there isn't a real case statement as in C or Pascal, but, you can
> emulate one through a block =)
>
>
> SWITCH: for ($str_fruit) {
>       if (/apple/) {
>               ...
>               last SWITCH;
>       }
>       if (/banana/) {
>               ...
>         last SWITCH;
>       }
>       if (/orange/) {
>               ...
>               last SWITCH;
>       }
> }
>

Or, with a little less typing:

for ($str_fruit) {
  /apple/ && do {&peal_apple ; last; };
  /pear/  && do {&thow_it; last ; };
  &unknown_fruit;
}

>
> Hope this helps,
>
> Marc...
>
> | Hi,
> |
> | there is in Perl a statement "case" like in "C" or in "Pascal" ???
> |
> |     Walter

-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to