my @upChars = getUpperCaseChars( @chars ); # @upChars is now ( 'A', 'B', 'C', undef, undef, undef, 'F', 'G' ) #### my @charsWithNoUpperCase = @chars[grep { !defined @upChars[$_] } 0..$#upChars]; #### my @charsWithNoUpperCase foreach my $index ( 0..$#upChars ) { push @charsWithNoUpperCase, $chars[$index] if !defined $upChars[$index]; }