http://www.perlmonks.org?node_id=930199


in reply to Re^3: array within an array
in thread array within an array

You need to see if you can find all the elements before you start to replace. So you need to hold them in memory somewhere. If you reach to end of the array before finding them, just put them as it is on their respective locations.