use strict; use warnings; my @chars = qw( a b c ? : ! f g ) ; my %upchars ; @upchars{@chars} = ( 'A', 'B', 'C', undef, undef, undef, 'F', 'G' ); # getUpperCaseChars( @chars ); my @charsWithNoUpperCase = grep {! defined $upchars{$_} } @chars;