my @userArray = qw(batman robin joker); my @userArray2; #this is a null array my @mainArray = (@userArray, @userArray2); #### #@set should consist "batman robin joker", but not #"batman robin joker NULL" #### my @set = map { exists($_)? $_ : delete($_) } @mainArray;