Mark J. Reed wrote:
On 2004-06-14 at 22:58:58, Matthew Walton wrote:
'it would be better to explicitly just say
(@list.grep value) = undef
although I think that might be supposed to be
(@list.grep value) »= undef;
Those do different things according to my understanding. The first
removes all matching items from the list; the second replaces the matching items with undef.
e.g. (please forgive any Perl6 syntax errors):
[1,2,3,4,5].grep { $_ % 2 } = undef
results in the list
[2,4]
while
[1,2,3,4,5].grep { $_ % 2 } »= undef
results in the list
[undef, 2, undef, 4, undef]
That's a very good point, and seems rather likely. I wasn't thinking of it that way. Quite cunning really.