On 9/10/06, chen li <[EMAIL PROTECTED]> wrote:
Although I read the usage for grep and map using perldoc -f grep or map I don't think I really get the differences between them.
The expression in a map is evaluated in a list context. The list that it returns is included in the result list. The expression in a grep is a Boolean value, so it's evaluated in a scalar context. If it's true, the corresponding value from the list (that is, the value of $_ inside the expression) is included in the result list. These properties make grep useful for simply selecting elements from a list, while map is able to transform a list in a more general way. Does that give you what you needed? Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>