in reply to Re^8: Reading tab/whitespace delimited text file
in thread Reading tab/whitespace delimited text file
Why does the original code behave differently when i use the while(<FILEHANDLE>) loop as a file handle to read a particular section of code(say between line 2-10) instead of using EOF ..???
Because while( <DATA> ) { reads and discards a line each time it is executed. And that line contains a header (or data) that is required.
If you need to skip 29 lines, do so before entering the while loop:
<DATA> for 1 .. 29; until( eof( DATA ) ) { ...
And to exit the loop after the 40th line has be read:
until( eof( DATA ) ) { last if $. == 40; ...
|
|---|