in reply to i cant see whats wrong with this:

Wrong language!

Perl uses if(cond) {block} elsif (cond) { block } else { block }

See perlman:perlsyn.


Well It's better than the Abottoire, but Yorkshire!

Replies are listed 'Best First'.
Re: Re: i cant see whats wrong with this:
by Anonymous Monk on Aug 30, 2002 at 09:01 UTC
    really? i used the  if(cond){block}else if(...){...} construction in several perlscripts and there, they worked just fine.
    but i'll try it your way. thx...
    --> it seems to work....

      Directly from perlman:perlsyntax manual.

      The following compound statements may be used to control flow: if (EXPR) BLOCK if (EXPR) BLOCK else BLOCK if (EXPR) BLOCK elsif (EXPR) BLOCK ... else BLOCK LABEL while (EXPR) BLOCK LABEL while (EXPR) BLOCK continue BLOCK LABEL for (EXPR; EXPR; EXPR) BLOCK LABEL foreach VAR (LIST) BLOCK LABEL foreach VAR (LIST) BLOCK continue BLOCK LABEL BLOCK continue BLOCK

      Do you see a syntax diagram for

      if(cond){...} else if(cond) {...} else {...} there anywhere?

      Sorry! I don't know what language you were using, but it wasn't Perl!


      Well It's better than the Abottoire, but Yorkshire!
        you're right,

        i used this syntax, due to my c++ and java knowledge (although there would be a switch - case statement in use...).
        i believed that i got this structure also in other perlscripts.
        as i checked it, i saw, that i've had this prob earlier and solved it with a rather ineffective workaround...

        thanks again, now it works just fine!
        m.t.minded