From
perldata: "A word that has no other interpretation in the grammar will be treated as if it were a quoted string.". So those bare words in your
print (except for my which causes a compolation error) are treated as if you wrote:
print $foo.'bar'.'how'.'is'.'the'.'syntax'