in reply to Begginer's question: If loops one after the other. Is that code correct?
Hi predrag, Welcome to the Monastery!
There's nothing wrong with your code per se, but it seems like you could combine the last and the first conditionals into another if ... else. ( On the other hand, as soon as you have an if/else like that, you might want to start using a hash lookup or dispatch table instead. )
( edit: The most important thing is clarity and maintainability ... write code that you can understand "at-a-glance" when you come back to it after a couple of months. As you become more fluent in Perl, your code will become more succinct, but there's nothing wrong with being very explicit. )
Hope this helps!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Begginer's question: If loops one after the other. Is that code correct?
by MidLifeXis (Monsignor) on Jan 11, 2017 at 12:39 UTC |