in reply to Re^3: how to avoid nested looping?
in thread how to avoid nested looping?
What version of Perl are you using and on which platform? perl -V would be nice. I'm not saying map is faster, but then, I'm not really worried about it. I'm more worried about code correctness and maintainability.
One interesting thing about map and friends which is not appreciated enough is how map says "do this for everything in the list" when foreach says "do this to each thing in the list." It's a subtle distinction, but one study of programming discovered that programmers tend to make fewer errors when using commands that operate on an entire set instead of looping constructs that operate on individual members of the set. Unfortunately for most programmers, we're given tools for the latter while the former are often considered "advanced" when in reality their simpler. We get taught the bad way and we get used to it. Go figure :)
Cheers,
Ovid
New address of my CGI Course.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: how to avoid nested looping?
by lidden (Curate) on Feb 04, 2005 at 12:02 UTC | |
|
Re^5: how to avoid nested looping?
by bgreenlee (Friar) on Feb 04, 2005 at 13:55 UTC | |
|
Re^5: how to avoid nested looping?
by tphyahoo (Vicar) on Feb 04, 2005 at 11:27 UTC |