Because $val gets quoted, and when it's blank the value is '', so thats length 2.