Title: RE: counting lines in a text files

use open IN => ":raw";
I find this works well for files that have occasional control chars in them.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Eric Vercelletto

Sent: 23 June 2005 09:38
To: [email protected]
Subject: counting lines in a text files

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 ?

thanks

Eric

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. Access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any other action taken or any views, opinions or advice contained in this e-mail are those of the sending individual and not necessarily those of the firm. It is possible for data transmitted by e-mail to be deliberately or accidentally corrupted or intercepted. For this reason where the communication is by e-mail, J&E Davy does not accept any responsibility for any breach of confidence which may arise from the use of this medium. If you have received this e-mail in error please notify us immediately at mailto:[EMAIL PROTECTED] and delete this e-mail from your system.
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to