in reply to foreach inside print

That's because foreach is a statement, not an expression. Function arguments are expressions, but not statements. Use map in this case:
print table ({...}), map {Tr (td (...)), Tr ({...})} @files;

Abigail