Hi All, brand new to perlmonks here, from few days ago and it is my first post. I came to Perl last spring (from Linux and bash scripting), really love it, learned a bit and finished some small projects, but still a begginner. My question is: Is it correct to use few if loops one after the other, as I did in this code? So, loops are not nestled and the midle if loop is with else. All that is a content of a foreach loop.
if ($char eq "a") { some code … } if ($k ==2) { some code … } else { some code … } if ($char eq "b") { some code … }
I know standard use of loops, but somehow, while trying to make my script work, I've came to this solution, that works well in my case. There is only few similar examples of using if loops such way I've found on the web, so I don't know if it is ok and maybe it is considered something to avoid or a dirty code? If it is ok, I would like to hear your comments about the whole script, but maybe that should be sent with other title. If not ok, I will begin to write the other code.
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |