Eric Vercelletto wrote: > Hi folks, > > although the answer seems simple, I have a strange phenomenon while reading > a text file, where I want to identify each > line by its linenumber > > obviously first reflex is to use $. > or at each iteration of foreach $line ( <MYFILE>) > $linenumber++ ; > > this work in the majority of the lines > > but it seems some lines are not read by the foreach , and I suspect them to > be lines only containing a \n > I have also seen lines ending with \x0d\n but this does not seem to count > for 2 lines though > > I will provide a test case during the day, but does anyone have an idea of > what can happen ?
Should work fine. Try reading the file and removing any \r or \n's from each line. Then append a \n and write it back out to another file or console with the line number prefixed for comparison to what the orig file thinks is a line. (\n should expand to a \r\n in text mode). If you don't figure it out, post a short 10 line or whatever script with a hunk of data that duplicates the problem. -- ,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED] (_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED] / ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/ -/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff) _______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
