in reply to print every nth element of an array.

Homework?

DB<122> @a = a..k => ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k") DB<123> $n=3,$x=0 => (3, 0) DB<124> grep {not ++$x % $n } @a => ("c", "f", "i")

Cheers Rolf

( addicted to the Perl Programming Language)