in reply to Skipping Elements in an Array
You can keep a flag to say that an element should be skipped. It appears that you also want to skip the triggering element, and that a skipped length-two element does not trigger. Those properties will be controlled by the order of test and flag manipulations.
#! /usr/bin/perl -w use strict; my @Array = ('AAA','BB','CCCC','DD','EEEEE','FFF','GGGG'); my $num_of_skip =2; my $skipping = 0; for (@Array) { $skipping++, next if $skipping and not $skipping > $num_of_skip; $skipping++, next if 2 == length; print $_, $/; $skipping = 0; }
After Compline,
Zaxo
|
|---|