http://www.perlmonks.org?node_id=998550


in reply to Re: beginner scripting question re: if elsif else
in thread beginner scripting question re: if elsif else

kennethk-

Thanks for your reply. So, with if elsif else, if the first condition is true, the whole script still runs anyway (if no exits scripted)?

j.

  • Comment on Re^2: beginner scripting question re: if elsif else

Replies are listed 'Best First'.
Re^3: beginner scripting question re: if elsif else
by Dlamini (Novice) on Oct 11, 2012 at 21:17 UTC

    Yes, the first part of your code gathers information from the user, then the second part actually does something with it. The way you have it, it will ask all the questions, and get all the answers from the user BEFORE getting to the if/else section. Once it is in the if/else section, it will do as you suspect -- i.e. if it is snowing, then that satisfies the if condition and therefore the else conditions are skipped.

      Dlamini-

      Thanks! That's just what I needed to know.

      j.