in reply to Re^5: nested <FILE> read returns undefined?
in thread nested <FILE> read returns undefined?
$line = <FILE>; # reads one line from FILE; @lines = <FILE>; # slurps up the whole thing. for $line (<FILE>) ... # which of the above applies?
The thing that really makes the visual assessment ambiguous is the placement of $line in the for statement, which is the source of the perceived ambiguity. Granted, I only saw it as the scalar form, and I do realize that it'd be more like saying
for $line (@lines)
which clarifies how perl is reading it (and thus, what happens with <FILE>), but seeing both ways now makes the ambiguity more understandable.
|
|---|