in reply to Re^5: Control Structures
in thread Control Structures
Well, that's what I get for posting before the Mt. Dew has kicked in -- I completely missed what the closure was doing. (and of course, I didn't actually run it).
But well, that being said, there are cases where switch is useful. Yes, it can be done through work arounds, but if you're going to do this sort of thing often enough, it's annoying to have to do extra work when other languages have it built in, and you know that the one part you're dealing may be easier to implement in some other language.
I know there are modules, and plenty of different ways to handle switch-like syntax in Perl, possibly because your dispatch tables would be tuned differently depending on your exact needs. Sometimes, I just want something to work, no matter how inefficiently, for those times when my time is more valuable than the execution time of the program --
I don't want to research which module best fits my needs, and doesn't have known issues, then go and download the module through CPAN, only to find that it has some other dependancy (that I'm going to need to install on whatever other machines I may try to run this script on, etc.). Modules may be great, but there's always the assumption that something has been more thoroughly tested if it's packaged with the main distribution, or if it's a builtin function, and it's going to be less of a headache to maintain in a multiple system environment.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Control Structures
by Roy Johnson (Monsignor) on May 10, 2005 at 16:00 UTC |