So what you want is to print out the subscript separator $;, but not print it out if it is completely blank (i.e. just whitespace, empty string), or if it is undefined?

If I understand you right you want:

if ( defined $operator and $operator =~ /\S/ ) {
#print operator here
#it is defined and contains something
#that is not whitespace
}
else {
#do something else as $operator is either
#not defined or it does not contain a
#non whitespace character
}