in reply to printing the subscript separator
$operator !~ /[^\s+]/ means "the value of operator does not have, somewhere inside it, anything that is not a whitespace character or a '+' symbol" which basically means the only thing this will match is a word that is all whitespace and/or "+" symbols... not quite what you want :)
I'd go with $operator =~ /^\s*$/