in reply to Re^2: How to count number of multiple logical conditions used in if,elseif or while in perl
in thread How to count number of multiple logical conditions used in if,elseif or while in perl

I updated my code below based on your updated and much better formatted requirements. Thanks for doing that!

You should be aware that something like this [\&&\||] doesn't do what I think you think it does! This is a character set with "& and |". double && can't be specified that way.

The main problem I see is an overly complex looping and program structure. My code to deal with the "while" has one loop statement (a for loop), one regex and one print. Your code goes 4 levels deep with complex if statements. I did put an extra "for" to skip lines in case "(" wasn't on the same line as the "while", but that is just gravy.

Glad to help you. Is this some sort of homework assignment? It is ok with me if it is, but I'd like to know that.

  • Comment on Re^3: How to count number of multiple logical conditions used in if,elseif or while in perl
  • Download Code