From: Pit Capitain Date: 2006-06-22T17:37:36+09:00 Subject: Re: bug in $. ? Wybo, I added my comments below: > Pit Capitain wrote: >> $. is the number of the last line read from the current input file. >> When you read lines from DATA, you're reading the lines 8..11 of your >> file "t". Why do you think line 8 should be reported as line 1? > > 1. because DATA does not point to my input file `t', but to the DATA > section in it. Reading from DATA is not expected to return lines other > than those after __END__ DATA does indeed "point to" the input file, right after the __END__. You can verify this for example by calling DATA.rewind. After that, you can read the text before the __END__. > 2. As is, $. is useless when reading from DATA Why do you need $. to start from 0 when reading from DATA? What is it that you're trying to do? > 3. Even if you see $. as a pointer to the program source, then setting > it to zero should help. In fact, the program part of the file has > already been read at that point. Personally, I think it shouldn't be allowed to change the $. variable at all. YMMV of course. > 4. In Perl it works as (I) expected. But that may be a reason to do > things differently, of course. Regards, Pit