The syntax of this command is quite simply - step <step>, <array> - where <step> is the step value and <array> is the array to iterate through.
#!/usr/bin/perl -Tw use strict; sub step { my $step = shift; return map { $_[$_] } grep { $_ % $step == 0 } 0..$#_; } my @array = ( 'a' .. 'z' ); print join( ' ', step( 5, @array ) ), "\n";
In reply to Stepping through an array by rob_au
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |