http://www.fmi.uni-passau.de/archive/doc/unix/perl/faq/2.7.html (Einblicke ins Internet, 10/1995)
Why doesn't "local($foo) = <FILE>;" work right?
Why doesn't "local($foo) = <FILE>;" work right?
Well, it does. The thing to remember is that local() provides an array
context, and that the <FILE> syntax in an array context will read all the
lines in a file. To work around this, use:
local($foo);
$foo = <FILE>;
You can use the scalar() operator to cast the expression into a scalar
context:
local($foo) = scalar(<FILE>);