|Welcome to the Monastery|
Will the sorting order of an array used in producing new arrays be retained?by jospan (Novice)
|on Oct 09, 2012 at 21:02 UTC||Need Help??|
jospan has asked for the
wisdom of the Perl Monks concerning the following question:
Oh Elders of Perldom, Wizards of Code and Masters of the Divine Editor enligthen a simple novice please! :)
I have an array (hereafter known as The Master Array).
The array is sorted.
I produce new arrays as subsets of The Master Array by using grep.
My question(s) is this:
1) will the subset arrays still be sorted as The Master Array or will I have to re-sort the subset arrays if I wish to ensure that these are sorted?
2) Whatever the answer to 1): can the answer be generalized to all cases where a function (say map) is used to produce arrays from a sorted master array?