in reply to Interesting issues with split function

(It seems your question was edited. It would have been nice if you had left the original question there, and either posted a reply, or appended your update to your original post.)

If I were to guess why it prints differently, I'd say the special case for split(" ") is handled at compile time and looks for a string literal. Use $d = "\\s+"; or $d = qr/\s+/; instead of $d = " ";.