my $count = 0; for my $input (@input) { next unless $count++ % 2 == 0; print "Got $1\n" if $input =~ m/DosID=(.{6})/; }