Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^4: Order in which grep/map receive elements

by afoken (Monsignor)
on Oct 06, 2012 at 04:37 UTC ( #997576=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use strict;
    ...
    
    is(join(":",grep { $_%2==0 } 1..6),"2:4:6","grep keeps order");
    is(join(":",map { 1+$_ } 1..6),"2:3:4:5:6:7","map keeps order");