Contextual

Robrt on 2003-09-05T02:33:40

In response to Tassilo von Parseval's query q[What is the point of "foreach", then?] on p5p, Yitzhack Scott-Thoennes said:

call_me_with_void_context($_) foreach @list;
grep call_me_with_scalar_context($_), @list;
map call_me_with_list_context($_), @list;

I think that sums it up beautifully. Someone should use it in a book, or send a patch to the FAQ.


Wrong! Wrong! Wrong!

ethan on 2003-09-05T15:53:21

In response to Tassilo von Parseval's query q[What is the point of "foreach", then?] on p5p,

Nope, that wasn't me. Kurt Starsinic raised this question.

I was just the one who sent the patch to speed up the void map.