Mark,
I only recently started coding in PERL so don't take the following as
official.

There is no CASE statement in PERL. Instead you use something called SWITCH.

The O'Reilly book has an example of how to use the SWITCH statement.

Kaustav

> -----Original Message-----
> From: Mark Martin [mailto:[EMAIL PROTECTED]]
> Sent: 01 May 2001 16:55
> To: [EMAIL PROTECTED]
> Subject: IF statements
>
>
> What I have is this:
>
> if ($variable == 02){
>       print OUT1 "$variable";
>       $lines1 ++;
> } elsif($variable == 03){
>       print OUT1 "$variable\n";
>       $lines2 ++;
> } elsif($variable == "08"){
>       print OUT1 "$variable\n";
>       $lines2 ++;
> }  elsif($variable == 79){
>       print OUT3 "$variable\n";
>       $lines3 ++;
> }  elsif($variable == 93){
>       print OUT3 "$variable\n";
>       $lines3 ++;
> }  elsif($variable == 99){
>       print OUT3 "$variable\n";
>       $lines3 ++;
> }
>
> So I need to shorten that to if (variable == "02" OR "03" OR
> "08"){ .....etc
>
> I think what I need is something called a case. but I can't find
> the syntax
> anywhere.
> Cheers.
> _____________________________________________
>
> Mark Martin
> Computer Centre
> National University of Ireland Maynooth
>
> Tel: (01)708 4716/3830
> Fax: (01)628 6249
>
>

Reply via email to