in reply to File Reading and Closing confusion
assigns a line to $_ on each iteration of the loop, as mentioned, however outside a loop it does not. Just plainwhile (<FH>) {...}
does read a line from the file, but does not assign it to $_. So far as I know it is not stored. The assignment to $_ is magic that only occurs inside the condition of a while loop. $line = <FH>; works as expected - the line which has been read is assigned to $line.<FH>;
|
---|