in reply to Re: Re: i cant see whats wrong with this:
in thread i cant see whats wrong with this:

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!

Replies are listed 'Best First'.
Re: Re: Re: Re: i cant see whats wrong with this:
by Anonymous Monk on Aug 30, 2002 at 09:27 UTC
    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

      Your welcome!

      And don't worry, you aren't the only one. I still do this every now and again. Actually, nearly everytime I type an elsif it comes out as  else if or elif when I first type it. It's become almost automatic to go back and correct it as I go, before I ever attempt to run the code.

      Human brains are weird things. It seems to take an age to learn something, but un-learning it is oh, so much harder.