Ain't no time to hate! Barely time to wait! ~RH#!/usr/local/bin/perl -w use strict; my @a=qw(las vegas every saturday night third is my element); my $leng= @a; my $i; print "the index of the array is $leng. \n"; for ($i=0; $i <= $leng; $i++) { if (($i+1)%3==0) { print "$a[$i] "; } }
In reply to Elegantly Selecting Every 3rd Element in an Array. by jerrygarciuh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |