|P is for Practical|
(jeffa) 5Re: (Ovid - Why I love nested If-Else blocks)by jeffa (Bishop)
|on Jan 04, 2002 at 04:30 UTC||Need Help??|
Awwww man, i like that ... thing:
gave me an Atari flashback! :D
I do commend runrig for giving a working piece of code that kicked the dog doo out of it's conterpart. It took me very little time to parse it, but i am not a newbie anymore.
For a newbie - that's just got to look like a nightmare. I really think that this is why Ovid loves nested if-else blocks:
Because newbies (especially those that are new to Perl but not to programming!) can understand them must faster.
Me, i like the dispatch table - once you really start using them, it's hard not to. Point of little return, so to speak. For one thing, it is very scalable - adding two new conditions was very easy:
I did move the '?' and the ';' to make it easier to cut-copy and paste it ... but, man have we gotten away from a simple solution:
Tuck the check for the value of $foo away in the subroutines themselves, redundant, but that should be a piece of cake to follow and seems more configurable in the long run as well as very straight foward. The redundant pieces will end up becoming different anyway, thanks to Murphy's Law. ;)