> -----Original Message-----
> From: Jaishree Rangaraj [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 16, 2002 10:53 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Syntax error
> 
> 
> 
> Hello All:
> 
>  Can anybody please tell me if this syntax is corect. I am 
> getting syntax error in this block.
> 
> foreach $sorted_field (@sorted_fields) {
>                 if ($Config{'print_blank_fields'} || 
> $Form{$sorted_field}) 
>   {
>                     $_=$sorted_field;
>                     $field=m/\W(I\w)/;
>                     print "$field";
>                       if (($sorted_field eq 
> '1')||($sorted_field eq '2'))
>    {
>                          print "$Form{$sorted_field}<br>";
>                  } 
>         elsif
>    {

This brace needs to be moved to follow the condition below

>                          (($sorted_field ge '3') && 
> ($sorted_field le '10')) 
>      print "$Form{$sorted_field}<br>";
>    } 
>                       else 
>    {
>      print "$Form{$sorted_field}";
>    }
>                                
>                  }
>         }

You should use a consistent indenting style rather than the
abstract art approach. See "perldoc perlstyle"

I fixed the error and reformatted thusly:

    foreach $sorted_field (@sorted_fields) {
        if ($Config{'print_blank_fields'} || $Form{$sorted_field}) {
            $_=$sorted_field;
            $field=m/\W(I\w)/;
            print "$field";
            if (($sorted_field eq '1')||($sorted_field eq '2')) {
                 print "$Form{$sorted_field}<br>";
            } elsif (($sorted_field ge '3') && ($sorted_field le '10')) {
                print "$Form{$sorted_field}<br>";
            } else {
                print "$Form{$sorted_field}";
            }
        }
    }

As a side note, the following test is suspicious:

  ($sorted_field ge '3') && ($sorted_field le '10')

This condition will always be false. Do you see why?

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

Reply via email to