Skip to content

Instantly share code, notes, and snippets.

@tempire
Created April 15, 2014 17:26
Show Gist options
  • Save tempire/10749982 to your computer and use it in GitHub Desktop.
Save tempire/10749982 to your computer and use it in GitHub Desktop.
every n of element, limited by selection of /3
# The initial array
my @a = (1..100);
# Copy it, every 3rd elements
my @b = @a[ map { 3 * $_ } 0..$#a/3 ];
# Print it. space-delimited
$, = " ";
say @b;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment