The suggestion to use push in the map block was wrong. That's all. (In my opinion, explaining map as a synonym for for doesn't help people understand what map actually does.)
Part of the confusion is that the original poster needed grep anyway.
Comment on Re: Re: Re: Re: Re: Re: foreach/map equivalency