<?xml version="1.0" encoding="windows-1252"?>
<node id="997491" title="Re: Order in which grep/map receive elements" created="2012-10-05 10:54:08" updated="2012-10-05 10:54:08">
<type id="11">
note</type>
<author id="757127">
tobyink</author>
<data>
<field name="doctext">
&lt;p&gt;You are correct that this is not stated in the documentation, but it has always been the case, and there is a large amount of code that relies on it, so it can't really change in future Perls without breaking massive amounts of code.&lt;/p&gt;

&lt;p&gt;One thing I could kind of see happening in a future version of Perl might be to have map/grep fork and run the block in parallel on each element, but still return the results in order. This would still break some code, but if it were enabled only by a particular lexical pragma, then it could work.&lt;/p&gt;

&lt;p&gt;But anyway, the current behaviour of map/grep being preserved is not something you ought to worry about.&lt;/p&gt;

&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-757127"&gt;
&lt;small&gt;&lt;small&gt;
&lt;tt&gt;perl -E'sub Monkey::do{say$_,for@_,do{($monkey=&amp;#x5B;caller(0)]-&gt;&amp;#x5B;3])=~s{::}{ }and$monkey}}"Monkey say"-&gt;Monkey::do'
&lt;/tt&gt;&lt;/small&gt;&lt;/small&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
997453</field>
<field name="parent_node">
997453</field>
</data>
</node>
