Title: counting lines in a text files
|
You might also try:
use Tie::File; use Fcntl;
tie @lines, Tie::File, $file, memory => 20_000_000 or die
"can't open file: $!\n"; [EMAIL PROTECTED];
print $num;
--Richard
-----Original Message----- From:
[EMAIL PROTECTED] on behalf of Eric
Vercelletto Sent: Thu 6/23/2005 4:38 AM To:
[email protected] Cc: 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
|
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs