Hi Mark,
Try this:
switch:for ($variable) { #put $variable into $_
(/02/ || /03/ || /08/) && do {
print OUT1 "$variable\n";
$lines1++;
last; } ;
(/79/ || /93/ || /99/) && do {
print OUT3 "$variable\n";
$lines3++;
last; } ;
}
Using this code, if the bit before the && is true, i.e. one of the
regular expressions is true, then it evaluates (does) the bit after the
&&.
Gary
On Tuesday 01 May 2001 4:54 pm, Mark Martin wrote:
> 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
--
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