in reply to Read Every n elements from Array

Perhaps shortest?

$test = [ "1" , "2" ,"3" , "4" ,"5" ,"6" ,"7" , "8" ,"9" ,"10" ]; @new_Array=grep++$i%3<1,@$test;

Oops!

Replies are listed 'Best First'.
Re^2: Read Every n elements from Array
by ikegami (Patriarch) on Feb 17, 2011 at 22:28 UTC
    That doesn't do the same thing at all. The OP grabs three at a time. That grabs every third.

      What is he trying to do with @new_Array as he is creating new array everytime.

      OP, Do you have any idea what are you trying to achieve here.