for my $i (0 .. $#ARGV) { if($ARGV[$i] =~ /meets some condition/) { # doesn't matter as $i will be set again in the next iteration $i += 2; } }