----- Original Message ----- From: "Craig Cardimon" <[EMAIL PROTECTED]>
To: "ActivePerl" <[email protected]>
Sent: Friday, March 10, 2006 5:39 PM
Subject: Tie::File seems to run slowly or grind


Anyway, all I'm trying to do right now is get a reading on how many lines (records) there are in my test file, but the script simply grinds and grinds.

My somewhat abbreviated code:

use Tie::File;
use Fcntl 'O_RDONLY';

tie ( @lines, "Tie::File", "$testfile", mode => O_RDONLY ) or die "\nUnable to Tie File >$testfile< \n" ;

my $n_recs = @lines;

print "\n\tThere are $n_recs records or lines are in the file\n";


Try this

open FILE,"<$testfile";
my $n_recs=0;
while(my $rec = <FILE>) {$n_recs++}
close FILE;
print "\n\tThere are $n_recs records or lines are in the file\n";

Is this what you need?

Petr Vileta, Czech republic
(My server reject all messages from Yahoo and Hotmail. Send me your mail from another non-spammer site please.)



_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to