in reply to nested <FILE> read returns undefined?

Your code :
open FILE, "foo" || die "can't open file";
will not die when you need it to. "||" has a high precedence, so the "die" will never happen as long as the file name evaluates to TRUE (which will ALWAYS be true for a non-null file name).

It can be fixed either by using parens, or by using the or operator instead of "||", since "or" has a very low precendence.

See perlop, or a multitude of posts such as this one on this subject.

     "For every complex problem, there is a simple answer ... and it is wrong." --H.L. Mencken