in reply to foreach inside print

foreach does not return anything (well, maybe it does, but not what you expect). You can use multiple prints as suggested elsewhere, or use a join-map combination instead.

Update: join is not necessary here.