Help for this page

Select Code to Download


  1. or download this
    $list = '1,2,3,4,5,6,7,8';
    
    @odds = grep $_ % 2, split(/,/, $list);
    @evens = grep not($_ % 2), split(/,/, $list);
    
  2. or download this
    $list = 'a,b,c,d,e,f,g,h';
    
    ...
    $i=0;
    @pos2 = grep $i++ % 2, split(/,/, $list);