Get STDIN, strip whitespace and newlines, and convert to uppercase if $upper is true
Created functions to eliminate repeated tests.