in reply to grep, map vs. foreach performance

Performance is an awful reason to choose one of these commands. They have different purposes, and should be used as they were intended. The clarity of your code is more important than the small performance differences.

In general, foreach is the one to use unless you are doing something that fits perfectly as a map or grep. map is for performing a simple transformation on a list that will return another list. grep is for selecting elements of a list that match a certain criteria (like grep'ing a file).